-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jan Krems
committed
Aug 25, 2017
1 parent
94d539c
commit f898741
Showing
12 changed files
with
192 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,25 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
const opinions = require('./lib/rules/opinions'); | ||
const conventions = require('./lib/rules/opinions'); | ||
const mistakes = require('./lib/rules/mistakes'); | ||
|
||
module.exports = Object.assign({ | ||
env: { | ||
es6: false, | ||
node: true, | ||
}, | ||
parserOptions: { | ||
sourceType: 'script', | ||
ecmaVersion: 5, | ||
sourceType: 'script', | ||
}, | ||
rules: { | ||
'no-param-reassign': 0, | ||
'prefer-rest-params': 0, | ||
'no-underscore-dangle': [2, { allowAfterThis: true }], | ||
strict: [2, 'global'], | ||
'comma-dangle': [2, { | ||
arrays: 'always-multiline', | ||
objects: 'always-multiline', | ||
functions: 'never', | ||
}], | ||
'prefer-spread': 0, | ||
} | ||
}; | ||
plugins: ['import', 'node', 'prettier'], | ||
rules: Object.assign(opinions, conventions, mistakes, { | ||
// Additional opinions | ||
|
||
// Additional conventions | ||
|
||
// Additional mistakes | ||
'node/no-unsupported-features': [2, { version: 4 }], | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
'use strict'; | ||
|
||
function* foo() { yield 42; } | ||
function* foo() { | ||
yield 42; | ||
} | ||
foo(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
'use strict'; | ||
|
||
function foo() { } | ||
function foo() {} | ||
|
||
const arr = [1, 2, 3]; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
'use strict'; | ||
|
||
module.exports = require('../node8.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Reasonable defaults for most lint settings | ||
*/ | ||
module.exports = { | ||
env: { | ||
es6: true, | ||
node: true, | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 2017, | ||
sourceType: 'script', | ||
}, | ||
plugins: ['import', 'node', 'prettier'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Rules in this file have good reasons but don't prevent bugs. | ||
* | ||
* If any of the rules in here can't be fixed, they should at most warn. | ||
* Not following conventions should not break builds, especially since they | ||
* might be a moving target. | ||
*/ | ||
module.exports = { | ||
'no-underscore-dangle': ['warn', { allowAfterThis: true }], | ||
'no-undef-init': 'off', // pending: Can't be auto-fixed | ||
'import/no-dynamic-require': 'off', // pending: Can't be auto-fixed | ||
strict: [2, 'global'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Only things we are pretty sure are mistakes | ||
* | ||
* There should be a fairly high bar to end up in this list unless the issue | ||
* can be fixed automatically. It's expected that each rule comes with a | ||
* documented (class of) bug it prevents. | ||
*/ | ||
module.exports = { | ||
'no-debugger': 'error', | ||
'no-empty': 'error', | ||
'no-func-assign': 'error', | ||
'no-template-curly-in-string': 'error', | ||
'no-unreachable': 'error', | ||
'no-unsafe-finally': 'error', | ||
'use-isnan': 'error', | ||
'no-unused-vars': [ | ||
'error', | ||
{ vars: 'all', args: 'after-used', ignoreRestSiblings: true }, | ||
], | ||
'no-use-before-define': [ | ||
'error', | ||
{ functions: true, classes: true, variables: true }, | ||
], | ||
'no-undef': 'error', | ||
'no-shadow': 'error', | ||
'no-label-var': 'error', | ||
'no-delete-var': 'error', | ||
'no-catch-shadow': 'off', | ||
|
||
'import/no-unresolved': ['error', { commonjs: true, caseSensitive: true }], | ||
'import/no-extraneous-dependencies': [ | ||
'error', | ||
{ | ||
devDependencies: [ | ||
'test/**', // tape, common npm pattern | ||
'tests/**', // also common npm pattern | ||
'spec/**', // mocha, rspec-like pattern | ||
'**/__tests__/**', // jest pattern | ||
'**/*.test.{js,jsx}', // repos with inline test files | ||
'test.{js,jsx}', // repos with a single test file | ||
'test-*.{js,jsx}', // repos with multiple top-level test files | ||
'**/*.{test,spec}.{js,jsx}', // tests where the extension denotes that it is a test | ||
'**/jest.config.js', // jest config | ||
'**/webpack.config.js', // webpack config | ||
'**/webpack.config.*.js', // webpack config | ||
'**/rollup.config.js', // rollup config | ||
'**/rollup.config.*.js', // rollup config | ||
'**/gulpfile.js', // gulp config | ||
'**/gulpfile.*.js', // gulp config | ||
'**/Gruntfile{,.js}', // grunt config | ||
'**/protractor.conf.*.js', // protractor config | ||
|
||
// Allow script & example files | ||
'scripts/**', | ||
'tasks/**', | ||
'examples/**', | ||
'example/**', | ||
], | ||
optionalDependencies: true, // allow optional deps to be required | ||
}, | ||
], | ||
'import/no-duplicates': 'error', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Rules in this file are ultimately random choices. | ||
* | ||
* No human should have to type on a keyboard to comply. | ||
* If it can't be --fix'ed, it doesn't belong in here. | ||
*/ | ||
module.exports = { | ||
'prettier/prettier': [ | ||
'error', | ||
{ | ||
singleQuote: true, | ||
trailingComma: 'es5', | ||
}, | ||
], | ||
'lines-around-directive': ['error', 'always'], | ||
'import/newline-after-import': 'error', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,18 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
parserOptions: { | ||
ecmaVersion: 2017, | ||
sourceType: 'script', | ||
}, | ||
plugins: [ | ||
'node', | ||
], | ||
rules: { | ||
const basics = require('./lib/basics'); | ||
|
||
const opinions = require('./lib/rules/opinions'); | ||
const conventions = require('./lib/rules/opinions'); | ||
const mistakes = require('./lib/rules/mistakes'); | ||
|
||
module.exports = Object.assign(basics, { | ||
rules: Object.assign(opinions, conventions, mistakes, { | ||
// Additional opinions | ||
|
||
// Additional conventions | ||
|
||
// Additional mistakes | ||
'node/no-unsupported-features': [2, { version: 4 }], | ||
'no-param-reassign': 0, | ||
'prefer-rest-params': 0, | ||
'no-underscore-dangle': [2, { allowAfterThis: true }], | ||
strict: [2, 'global'], | ||
'comma-dangle': [2, { | ||
arrays: 'always-multiline', | ||
objects: 'always-multiline', | ||
functions: 'never', | ||
}], | ||
'prefer-spread': 0, | ||
} | ||
}; | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,18 @@ | ||
'use strict'; | ||
|
||
module.exports = { | ||
env: { | ||
es6: true, | ||
node: true | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 2017, | ||
sourceType: 'script', | ||
}, | ||
plugins: [ | ||
'import', | ||
'node', | ||
'prettier', | ||
], | ||
rules: { | ||
// Random stylistic choices | ||
'prettier/prettier': ['error', { | ||
singleQuote: true, | ||
trailingComma: 'es5', | ||
}], | ||
'lines-around-directive': ['error', 'always'], | ||
'import/newline-after-import': 'error', | ||
const basics = require('./lib/basics'); | ||
|
||
// Code convention | ||
'no-underscore-dangle': [2, { allowAfterThis: true }], | ||
'no-undef-init': 'off', // pending: Can't be auto-fixed | ||
'import/no-dynamic-require': 'off', // pending: Can't be auto-fixed | ||
const opinions = require('./lib/rules/opinions'); | ||
const conventions = require('./lib/rules/opinions'); | ||
const mistakes = require('./lib/rules/mistakes'); | ||
|
||
// Bug prevention | ||
strict: [2, 'global'], | ||
'node/no-unsupported-features': [2, { version: 6 }], | ||
'no-debugger': 'error', | ||
'no-empty': 'error', | ||
'no-func-assign': 'error', | ||
'no-template-curly-in-string': 'error', | ||
'no-unreachable': 'error', | ||
'no-unsafe-finally': 'error', | ||
'use-isnan': 'error', | ||
'no-unused-vars': ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: true }], | ||
'no-use-before-define': ['error', { functions: true, classes: true, variables: true }], | ||
'no-undef': 'error', | ||
'no-shadow': 'error', | ||
'no-label-var': 'error', | ||
'no-delete-var': 'error', | ||
'no-catch-shadow': 'off', | ||
module.exports = Object.assign(basics, { | ||
rules: Object.assign(opinions, conventions, mistakes, { | ||
// Additional opinions | ||
|
||
'import/no-unresolved': ['error', { commonjs: true, caseSensitive: true }], | ||
'import/no-extraneous-dependencies': ['error', { | ||
devDependencies: [ | ||
'test/**', // tape, common npm pattern | ||
'tests/**', // also common npm pattern | ||
'spec/**', // mocha, rspec-like pattern | ||
'**/__tests__/**', // jest pattern | ||
'**/*.test.{js,jsx}', // repos with inline test files | ||
'test.{js,jsx}', // repos with a single test file | ||
'test-*.{js,jsx}', // repos with multiple top-level test files | ||
'**/*.{test,spec}.{js,jsx}', // tests where the extension denotes that it is a test | ||
'**/jest.config.js', // jest config | ||
'**/webpack.config.js', // webpack config | ||
'**/webpack.config.*.js', // webpack config | ||
'**/rollup.config.js', // rollup config | ||
'**/rollup.config.*.js', // rollup config | ||
'**/gulpfile.js', // gulp config | ||
'**/gulpfile.*.js', // gulp config | ||
'**/Gruntfile{,.js}', // grunt config | ||
'**/protractor.conf.*.js', // protractor config | ||
// Additional conventions | ||
|
||
// Allow script & example files | ||
'scripts/**', | ||
'tasks/**', | ||
'examples/**', | ||
'example/**', | ||
], | ||
optionalDependencies: true, // allow optional deps to be required | ||
}], | ||
'import/no-duplicates': 'error', | ||
} | ||
}; | ||
// Additional mistakes | ||
'node/no-unsupported-features': [2, { version: 6 }], | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict'; | ||
|
||
const basics = require('./lib/basics'); | ||
|
||
const opinions = require('./lib/rules/opinions'); | ||
const conventions = require('./lib/rules/opinions'); | ||
const mistakes = require('./lib/rules/mistakes'); | ||
|
||
module.exports = Object.assign(basics, { | ||
rules: Object.assign(opinions, conventions, mistakes, { | ||
// Additional opinions | ||
|
||
// Additional conventions | ||
|
||
// Additional mistakes | ||
'node/no-unsupported-features': [2, { version: 8 }], | ||
}) | ||
}); |