-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
38c4f02
commit 579d105
Showing
7 changed files
with
828 additions
and
436 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
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,167 +1,175 @@ | ||
module.exports = { | ||
parserOptions: { | ||
ecmaVersion: 2022, | ||
sourceType: 'module' | ||
import globals from 'globals'; | ||
import stylisticJs from '@stylistic/eslint-plugin-js'; | ||
|
||
export default { | ||
languageOptions: { | ||
globals: { | ||
...globals.browser, | ||
...globals.nodeBuiltin | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 2025, | ||
sourceType: 'module' | ||
} | ||
}, | ||
env: { | ||
browser: true, | ||
node: true | ||
plugins: { | ||
'@stylistic/js': stylisticJs | ||
}, | ||
rules: { | ||
// (a) => a not a => a | ||
'arrow-parens': [ | ||
'@stylistic/js/arrow-parens': [ | ||
'error', | ||
'always' | ||
], | ||
// } else { not }\n else { | ||
'brace-style': [ | ||
'@stylistic/js/brace-style': [ | ||
'error', | ||
'1tbs', | ||
{ | ||
allowSingleLine: true | ||
} | ||
], | ||
// last item in a list should not have a comma at the end | ||
'comma-dangle': [ | ||
'@stylistic/js/comma-dangle': [ | ||
'error', | ||
'never' | ||
], | ||
// [a, b] not [a,b] or [a ,b] | ||
'comma-spacing': [ | ||
'@stylistic/js/comma-spacing': [ | ||
'error', | ||
{ | ||
before: false, | ||
after: true | ||
} | ||
], | ||
// commas go at the end of a line, not the start | ||
'comma-style': [ | ||
'@stylistic/js/comma-style': [ | ||
'error', | ||
'last' | ||
], | ||
// if (a) { a++ } not if (a) a++ | ||
curly: [ | ||
'error' | ||
], | ||
// allow async-await | ||
'generator-star-spacing': [ | ||
'@stylistic/js/generator-star-spacing': [ | ||
'off' | ||
], | ||
// 2 space indentation (should match .editorconfig) | ||
indent: [ | ||
'@stylistic/js/indent': [ | ||
'error', | ||
2, | ||
{ | ||
SwitchCase: 1 | ||
} | ||
], | ||
// { key: value } not { key:value } | ||
'key-spacing': [ | ||
'@stylistic/js/key-spacing': [ | ||
'error', | ||
{ | ||
afterColon: true, | ||
beforeColon: false | ||
} | ||
], | ||
// { key: value } not {key: value} | ||
'keyword-spacing': [ | ||
'@stylistic/js/keyword-spacing': [ | ||
'error', | ||
{ | ||
before: true, | ||
after: true | ||
} | ||
], | ||
// let a = 1; not let a = 1; | ||
'no-multi-spaces': [ | ||
'@stylistic/js/no-multi-spaces': [ | ||
'error' | ||
], | ||
// No empty lines at top or bottom or file (except 1 EOF for git) | ||
// and no more than 2 empty returns in a file | ||
'no-multiple-empty-lines': [ | ||
'@stylistic/js/no-multiple-empty-lines': [ | ||
'error', | ||
{ | ||
max: 2, | ||
maxBOF: 0, | ||
maxEOF: 0 | ||
} | ||
], | ||
'no-restricted-syntax': [ | ||
'error', | ||
{ | ||
selector: 'Property[method="true"]', | ||
message: 'No shortform methods. x: function (). not x()' | ||
} | ||
], | ||
// Remove unused defined variables | ||
'no-unused-vars': [ | ||
'error' | ||
], | ||
// Don't reference a variable that is not defined | ||
'no-undef': [ | ||
'error' | ||
], | ||
// Only allow let and const, no var | ||
'no-var': [ | ||
'error' | ||
], | ||
// Curly braces start and end should match in a sane way | ||
'object-curly-spacing': [ | ||
'@stylistic/js/object-curly-spacing': [ | ||
'error', | ||
'always' | ||
], | ||
// Consistent operator placement on multiple lines | ||
'operator-linebreak': [ | ||
'@stylistic/js/operator-linebreak': [ | ||
'error', | ||
'after' | ||
], | ||
// Define each variable on it's own line | ||
'one-var': [ | ||
'error', | ||
'never' | ||
], | ||
// Don't have returns as the first or last character in a function or if statement | ||
'padded-blocks': [ | ||
'@stylistic/js/padded-blocks': [ | ||
'error', | ||
'never' | ||
], | ||
// Single quotes are used by ~80% of the JS community | ||
quotes: [ | ||
'@stylistic/js/quotes': [ | ||
'error', | ||
'single' | ||
], | ||
// Only require quotes around object keys that need them | ||
'quote-props': [ | ||
'@stylistic/js/quote-props': [ | ||
'error', | ||
'as-needed' | ||
], | ||
// TC39 strongly reccommends not relying on ASI | ||
semi: [ | ||
'@stylistic/js/semi': [ | ||
'error', | ||
'always' | ||
], | ||
// if (a) {} not if (a){} | ||
'space-before-blocks': [ | ||
'@stylistic/js/space-before-blocks': [ | ||
'error', | ||
'always' | ||
], | ||
// function name () {} not function name() {} | ||
'space-before-function-paren': [ | ||
'@stylistic/js/space-before-function-paren': [ | ||
'error', | ||
'always' | ||
], | ||
// a(b) not a( b ) | ||
'space-in-parens': [ | ||
'@stylistic/js/space-in-parens': [ | ||
'error', | ||
'never' | ||
], | ||
// 1 + 2 not 1+2 | ||
'space-infix-ops': [ | ||
'@stylistic/js/space-infix-ops': [ | ||
'error' | ||
], | ||
// Comments begin with a space | ||
'spaced-comment': [ | ||
'@stylistic/js/spaced-comment': [ | ||
'error', | ||
'always' | ||
], | ||
// if (a) { a++ } not if (a) a++ | ||
curly: [ | ||
'error' | ||
], | ||
'no-restricted-syntax': [ | ||
'error', | ||
{ | ||
selector: 'Property[method="true"]', | ||
message: 'No shortform methods. x: function (). not x()' | ||
} | ||
], | ||
// Remove unused defined variables | ||
'no-unused-vars': [ | ||
'error' | ||
], | ||
// Don't reference a variable that is not defined | ||
'no-undef': [ | ||
'error' | ||
], | ||
// Only allow let and const, no var | ||
'no-var': [ | ||
'error' | ||
], | ||
// Define each variable on it's own line | ||
'one-var': [ | ||
'error', | ||
'never' | ||
] | ||
} | ||
}; |
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,6 @@ | ||
export default const baseRestrictedSyntax = [ | ||
{ | ||
selector: 'Property[method="true"]', | ||
message: 'No shortform methods. x: function (). not x()' | ||
} | ||
]; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.