Skip to content

Commit 1ee46a7

Browse files
Shinigami92ST-DDT
andauthored
infra(deps): add eslint unicorn (#2418)
Co-authored-by: ST-DDT <[email protected]>
1 parent c0386ac commit 1ee46a7

File tree

3 files changed

+122
-0
lines changed

3 files changed

+122
-0
lines changed

.eslintrc.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module.exports = defineConfig({
1919
'plugin:@typescript-eslint/recommended-type-checked',
2020
'plugin:prettier/recommended',
2121
'plugin:jsdoc/recommended-typescript-error',
22+
'plugin:unicorn/recommended',
2223
],
2324
parser: '@typescript-eslint/parser',
2425
parserOptions: {
@@ -37,6 +38,64 @@ module.exports = defineConfig({
3738

3839
'deprecation/deprecation': 'error',
3940

41+
'unicorn/no-nested-ternary': 'off', // incompatible with prettier
42+
'unicorn/no-null': 'off', // incompatible with TypeScript
43+
'unicorn/number-literal-case': 'off', // incompatible with prettier
44+
45+
// TODO @Shinigami92 2023-09-23: prefer-at should be turned on when we drop support for Node 14.
46+
'unicorn/prefer-at': 'off',
47+
// TODO @Shinigami92 2023-09-23: prefer-string-replace-all should be turned on when we drop support for Node 14.
48+
'unicorn/prefer-string-replace-all': 'off',
49+
50+
// TODO @Shinigami92 2023-09-23: The following rules currently conflict with our code.
51+
// Each rule should be checked whether it should be enabled/configured and the problems fixed, or stay disabled permanently.
52+
'unicorn/better-regex': 'off',
53+
'unicorn/catch-error-name': 'off',
54+
'unicorn/consistent-destructuring': 'off',
55+
'unicorn/consistent-function-scoping': 'off',
56+
'unicorn/escape-case': 'off',
57+
'unicorn/explicit-length-check': 'off',
58+
'unicorn/filename-case': 'off',
59+
'unicorn/import-style': 'off',
60+
'unicorn/no-array-callback-reference': 'off',
61+
'unicorn/no-array-for-each': 'off',
62+
'unicorn/no-array-push-push': 'off',
63+
'unicorn/no-array-reduce': 'off',
64+
'unicorn/no-await-expression-member': 'off',
65+
'unicorn/no-console-spaces': 'off',
66+
'unicorn/no-for-loop': 'off',
67+
'unicorn/no-hex-escape': 'off',
68+
'unicorn/no-instanceof-array': 'off',
69+
'unicorn/no-negated-condition': 'off',
70+
'unicorn/no-new-array': 'off',
71+
'unicorn/no-object-as-default-parameter': 'off',
72+
'unicorn/no-process-exit': 'off',
73+
'unicorn/no-useless-switch-case': 'off',
74+
'unicorn/no-zero-fractions': 'off',
75+
'unicorn/numeric-separators-style': 'off',
76+
'unicorn/prefer-array-flat-map': 'off',
77+
'unicorn/prefer-array-some': 'off',
78+
'unicorn/prefer-code-point': 'off',
79+
'unicorn/prefer-date-now': 'off',
80+
'unicorn/prefer-export-from': 'off',
81+
'unicorn/prefer-includes': 'off',
82+
'unicorn/prefer-module': 'off',
83+
'unicorn/prefer-native-coercion-functions': 'off',
84+
'unicorn/prefer-negative-index': 'off',
85+
'unicorn/prefer-node-protocol': 'off',
86+
'unicorn/prefer-number-properties': 'off',
87+
'unicorn/prefer-object-from-entries': 'off',
88+
'unicorn/prefer-optional-catch-binding': 'off',
89+
'unicorn/prefer-spread': 'off',
90+
'unicorn/prefer-string-slice': 'off',
91+
'unicorn/prefer-string-starts-ends-with': 'off',
92+
'unicorn/prefer-ternary': 'off',
93+
'unicorn/prefer-top-level-await': 'off',
94+
'unicorn/prevent-abbreviations': 'off',
95+
'unicorn/require-array-join-separator': 'off',
96+
'unicorn/switch-case-braces': 'off',
97+
'unicorn/text-encoding-identifier-case': 'off',
98+
4099
'@typescript-eslint/array-type': [
41100
'error',
42101
{ default: 'array-simple', readonly: 'generic' },

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
"eslint-plugin-deprecation": "~2.0.0",
110110
"eslint-plugin-jsdoc": "~46.8.2",
111111
"eslint-plugin-prettier": "~5.0.0",
112+
"eslint-plugin-unicorn": "~48.0.1",
112113
"eslint-plugin-vitest": "~0.3.1",
113114
"glob": "~10.3.10",
114115
"npm-run-all": "~4.1.5",

pnpm-lock.yaml

Lines changed: 62 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)