Use eslint instead of jscs/jshint
Add .eslint.rc and test/.eslint.rc
This commit is contained in:
parent
f224f32e66
commit
750cf3d897
59
.eslintrc
Normal file
59
.eslintrc
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
"extends": "eslint:recommended",
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 6
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"node": true,
|
||||||
|
"es6": true
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"strict": ["error", "global"],
|
||||||
|
/* possible errors */
|
||||||
|
"no-console": 0,
|
||||||
|
"no-empty": ["error", { "allowEmptyCatch": true }], // disallow empty block statements
|
||||||
|
/* best practices */
|
||||||
|
"curly": 2, // enforce consistent brace style for all control statements
|
||||||
|
"no-eval": 2, // disallow the use of eval()
|
||||||
|
"no-extend-native": 2, // disallow extending native types
|
||||||
|
"no-global-assign": 2, // disallow assignments to native objects or read-only global variables
|
||||||
|
"no-implicit-coercion": 2, // disallow shorthand type conversions
|
||||||
|
"no-implicit-globals": 2, // disallow var and named function declarations in the global scope
|
||||||
|
"no-implied-eval": 2, // disallow the use of eval()-like methods
|
||||||
|
"no-lone-blocks": 2, // disallow unnecessary nested blocks
|
||||||
|
"no-useless-escape": 0, // disallow unnecessary escape characters
|
||||||
|
/* Stylistic Issues */
|
||||||
|
"array-bracket-spacing": 1, // enforce consistent spacing inside array brackets
|
||||||
|
"block-spacing": 1, // enforce consistent spacing inside single-line blocks
|
||||||
|
"comma-spacing": 1, // enforce consistent spacing before and after commas
|
||||||
|
"computed-property-spacing": 1, // enforce consistent spacing inside computed property brackets
|
||||||
|
"eol-last": 1, // enforce at least one newline at the end of files
|
||||||
|
"func-call-spacing": 1, // require or disallow spacing between function identifiers and their invocations
|
||||||
|
"indent": ["warn", 2, {"MemberExpression": 0, "SwitchCase": 1}], // enforce consistent indentation
|
||||||
|
"key-spacing": ["warn", { "mode": "minimum" }], // enforce consistent spacing before and after keywords
|
||||||
|
"keyword-spacing": 1, // enforce consistent spacing between keys and values in object literal properties
|
||||||
|
"linebreak-style": 1, // enforce consistent linebreak style
|
||||||
|
"no-trailing-spaces": 1, // disallow trailing whitespace at the end of lines
|
||||||
|
"no-var": 1, // require let or const instead of var
|
||||||
|
"object-curly-spacing": ["warn", "never"], // enforce consistent spacing inside braces
|
||||||
|
"one-var": ["warn", "never"], // enforce variables to be declared either together or separately in functions
|
||||||
|
"padded-blocks": ["warn", "never"], // require or disallow padding within blocks
|
||||||
|
"semi": ["warn", "always"], // require or disallow semicolons instead of ASI
|
||||||
|
"semi-spacing": 1, // enforce consistent spacing before and after semicolons
|
||||||
|
"space-before-blocks": 1, // enforce consistent spacing before blocks
|
||||||
|
"space-before-function-paren": ["warn", "never"], // enforce consistent spacing before function definition opening parenthesis
|
||||||
|
"space-in-parens": ["warn", "never"], // enforce consistent spacing inside parentheses
|
||||||
|
"space-infix-ops": 1, // require spacing around operators
|
||||||
|
/* ES6 */
|
||||||
|
"arrow-body-style": ["warn", "as-needed"], // require braces around arrow function bodies
|
||||||
|
"arrow-parens": ["warn", "as-needed"], // require parentheses around arrow function arguments
|
||||||
|
"arrow-spacing": 1, // enforce consistent spacing before and after the arrow in arrow functions
|
||||||
|
"no-useless-constructor": 1, // disallow unnecessary constructors
|
||||||
|
"object-shorthand": ["warn", "always", {"avoidQuotes": true}], // require or disallow method and property shorthand syntax for object literals
|
||||||
|
"prefer-arrow-callback": ["warn", {"allowNamedFunctions": true}], // require arrow functions as callbacks
|
||||||
|
"prefer-const": 1, // require const declarations for variables that are never reassigned after declared
|
||||||
|
"prefer-template": 1, // require template literals instead of string concatenation
|
||||||
|
"template-curly-spacing": ["warn", "never"] // require or disallow spacing around embedded expressions of template strings
|
||||||
|
},
|
||||||
|
"root": true
|
||||||
|
}
|
@ -11,9 +11,8 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": ": ${NODE_ENV=development} && node index.js",
|
"start": ": ${NODE_ENV=development} && node index.js",
|
||||||
"test": ": ${NODE_ENV=development} && npm run test:jshint && npm run test:jscs && npm run test:unit && npm run test:integration",
|
"test": ": ${NODE_ENV=development} && npm run test:lint && npm run test:unit && npm run test:integration",
|
||||||
"test:jshint": "jshint *.js src/**/*.js test/**/*.js",
|
"test:lint": "eslint config src test *.js",
|
||||||
"test:jscs": "jscs *.js src/**/*.js test/**/*.js",
|
|
||||||
"test:unit": "mocha --opts test/mocha.opts ./test/unit/",
|
"test:unit": "mocha --opts test/mocha.opts ./test/unit/",
|
||||||
"test:integration": "mocha --opts test/mocha.opts ./test/integration",
|
"test:integration": "mocha --opts test/mocha.opts ./test/integration",
|
||||||
"release": "npm run release:install && npm run release:archive",
|
"release": "npm run release:install && npm run release:archive",
|
||||||
@ -37,8 +36,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"chai": "^4.1.1",
|
"chai": "^4.1.1",
|
||||||
"co-mocha": "^1.1.2",
|
"co-mocha": "^1.1.2",
|
||||||
"jscs": "^3.0.7",
|
"eslint": "^4.4.1",
|
||||||
"jshint": "^2.9.4",
|
|
||||||
"mocha": "^3.2.0",
|
"mocha": "^3.2.0",
|
||||||
"sinon": "^1.17.4",
|
"sinon": "^1.17.4",
|
||||||
"supertest": "^3.0.0"
|
"supertest": "^3.0.0"
|
||||||
|
13
test/.eslintrc
Normal file
13
test/.eslintrc
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"extends": "../.eslintrc",
|
||||||
|
"rules": {
|
||||||
|
"no-shadow": 1
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"expect": true,
|
||||||
|
"sinon": true
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"mocha": true
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user