-
Notifications
You must be signed in to change notification settings - Fork 3
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
Ricardo Fernández Serrata
committed
Mar 7, 2024
1 parent
fde03cf
commit 8cae4fe
Showing
4 changed files
with
115 additions
and
109 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,101 +1,107 @@ | ||
'use strict' | ||
//eslint-disable-next-line no-implicit-globals | ||
const m = 'Use arrow fn instead.' | ||
"use strict" | ||
/* | ||
eslint | ||
no-magic-numbers: off, | ||
no-implicit-globals: off, | ||
*/ | ||
|
||
// shorthands to prevent typos | ||
const | ||
E = "error", | ||
W = "warn" | ||
|
||
/** | ||
regex pattern of intentionally unused identifiers | ||
*/ | ||
const UNUSED_ID = "^(_|(foo)?(ba[rz])?|bruh|yeet|gyatt?|amon?gus)$" | ||
|
||
//eslint-disable-next-line no-undef | ||
module.exports = { | ||
Check failure Code scanning / ESLint Disallow the use of undeclared variables unless mentioned in `/*global */` comments Error
'module' is not defined.
|
||
env: { | ||
browser: true, | ||
es2021: true | ||
}, | ||
extends: 'eslint:recommended', | ||
parserOptions: { | ||
ecmaVersion: 'latest' | ||
}, | ||
env: { browser: true, es2022: true }, | ||
parserOptions: { ecmaVersion: "latest" }, | ||
|
||
extends: "eslint:recommended", | ||
rules: { | ||
'no-magic-numbers': [ | ||
'warn', | ||
"no-unused-expressions": W, | ||
"no-unused-vars": [ | ||
W, | ||
{ | ||
ignore: [ | ||
-1, | ||
0, | ||
1, | ||
2 | ||
], | ||
ignoreArrayIndexes: true, | ||
ignoreDefaultValues: true, | ||
enforceConst: true | ||
varsIgnorePattern: UNUSED_ID, | ||
argsIgnorePattern: UNUSED_ID | ||
} | ||
], | ||
'no-unused-vars': [ | ||
'warn', | ||
"no-magic-numbers": [ | ||
W,// too many false-positives | ||
{ | ||
varsIgnorePattern: '^_$', | ||
argsIgnorePattern: '^_$' | ||
} | ||
], | ||
'no-param-reassign': 'error', | ||
'no-implicit-globals': [ | ||
'error', | ||
{ | ||
lexicalBindings: true | ||
} | ||
],/* | ||
'no-restricted-syntax': [ | ||
'error', | ||
{ | ||
selector: 'FunctionDeclaration', | ||
message: m | ||
}, | ||
{ | ||
selector: 'FunctionExpression', | ||
message: m | ||
} | ||
],*/ | ||
'no-empty-function': 'error', | ||
'no-loop-func': 'error', | ||
'no-lone-blocks': 'error', | ||
'no-constant-binary-expression': 'error', | ||
'no-self-compare': 'error', | ||
'no-unmodified-loop-condition': 'error', | ||
'no-unreachable-loop': 'error', | ||
'no-extra-label': 'error', | ||
'no-else-return': [ | ||
'error', | ||
{ | ||
'allowElseIf': false | ||
ignore: [-1, 0, 1, 2], | ||
ignoreArrayIndexes: true, | ||
ignoreDefaultValues: true, | ||
enforceConst: true | ||
} | ||
], | ||
'require-atomic-updates': 'error', | ||
'no-eval': 'error', | ||
'no-implied-eval': 'error', | ||
'dot-notation': 'error', | ||
'no-array-constructor': 'error', | ||
'max-depth': 'warn', | ||
'max-nested-callbacks': [ | ||
'error', | ||
3 | ||
], | ||
'max-params': [ | ||
'error', | ||
4 | ||
], | ||
'indent': [ | ||
'error', | ||
'tab' | ||
], | ||
'linebreak-style': [ | ||
'error', | ||
'unix' | ||
// Rust certified | ||
"prefer-const": E, | ||
/* | ||
this is not forbidden, it's just to make mutation intentional. | ||
to-do: replace by this proposal: | ||
https://github.com/Fishrock123/proposal-const-function-arguments | ||
*/"no-param-reassign": E,// should it be `W`? | ||
"no-var": E, | ||
"no-implicit-globals": [E, { lexicalBindings: true }], | ||
|
||
"no-empty-function": E, | ||
"no-loop-func": E, | ||
"no-lone-blocks": E, | ||
|
||
"no-constant-binary-expression": E, | ||
"no-self-compare": E, | ||
|
||
"no-unmodified-loop-condition": E, | ||
"no-unreachable-loop": E, | ||
|
||
"no-extra-label": E, | ||
|
||
// guard-clauses are better | ||
"no-else-return": [E, { "allowElseIf": false }], | ||
"no-useless-return": E, | ||
"no-unneeded-ternary": [E, { "defaultAssignment": false }], | ||
"no-useless-computed-key": [E, { "enforceForClassMembers": true }], | ||
"no-useless-concat": E, | ||
"no-useless-constructor": E, | ||
"no-useless-rename": E, | ||
"object-shorthand": E, | ||
|
||
"require-atomic-updates": E, | ||
|
||
"no-eval": E, | ||
"no-implied-eval": E, | ||
"no-script-url": E, | ||
|
||
"dot-notation": E, | ||
"no-array-constructor": E, | ||
"no-sequences": E, | ||
|
||
// prefer Object bags | ||
"max-params": [E, 4], | ||
"max-depth": W, | ||
// avoid CB-Hell | ||
"max-nested-callbacks": [E, 3], | ||
indent: [E, "tab"], | ||
"linebreak-style": [E, "unix"], | ||
"no-template-curly-in-string": W, | ||
quotes: [ | ||
E, | ||
// "single" is cleaner, | ||
// but "double" is more consistent with JSON | ||
"double" | ||
], | ||
'no-template-curly-in-string': 'warn', | ||
'quotes': [ | ||
'error', | ||
'single' | ||
semi: [ | ||
E, | ||
// ASI is confusing, regardless of what you do | ||
"never" | ||
], | ||
'semi': [ | ||
'error', | ||
'never' | ||
] | ||
// GH-issues can be used as alt, | ||
// that's why no `W` | ||
"no-warning-comments": [E, { "terms": ["todo", "to-do"] }] | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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