@egs33/eslint-config 4.1.2 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/airbnb/best-practices.js +0 -2
- package/airbnb/errors.js +2 -2
- package/airbnb/es6.js +6 -7
- package/airbnb/style.js +2 -8
- package/base.js +10 -3
- package/browser.js +3 -2
- package/nodejs.js +3 -2
- package/package.json +21 -15
- package/plugin-rules/imports.js +0 -5
- package/plugin-rules/stylistic.js +1 -1
- package/plugin-rules/unicorn.js +16 -0
- package/typescript-base.js +5 -4
- package/typescript-browser.js +3 -2
- package/typescript-node.js +3 -2
- package/typescript-svelte.js +7 -11
package/airbnb/best-practices.js
CHANGED
|
@@ -37,7 +37,6 @@ export const bestPractices = {
|
|
|
37
37
|
'no-extra-bind': 'error',
|
|
38
38
|
'no-extra-label': 'error',
|
|
39
39
|
'no-global-assign': ['error', { exceptions: [] }],
|
|
40
|
-
'no-native-reassign': 'off',
|
|
41
40
|
'no-implicit-coercion': [
|
|
42
41
|
'off', {
|
|
43
42
|
boolean: false,
|
|
@@ -128,7 +127,6 @@ export const bestPractices = {
|
|
|
128
127
|
},
|
|
129
128
|
],
|
|
130
129
|
'no-return-assign': ['error', 'always'],
|
|
131
|
-
'no-return-await': 'error',
|
|
132
130
|
'no-script-url': 'error',
|
|
133
131
|
'no-self-assign': [
|
|
134
132
|
'error', {
|
package/airbnb/errors.js
CHANGED
|
@@ -6,8 +6,8 @@ export const errors = {
|
|
|
6
6
|
'no-constant-binary-expression': 'error',
|
|
7
7
|
'no-constant-condition': 'warn',
|
|
8
8
|
'no-empty-character-class': 'error',
|
|
9
|
-
'no-extra-parens': ['error', 'all', { nestedBinaryExpressions: false }],
|
|
10
|
-
'no-extra-semi': 'error',
|
|
9
|
+
'@stylistic/no-extra-parens': ['error', 'all', { nestedBinaryExpressions: false }],
|
|
10
|
+
'@stylistic/no-extra-semi': 'error',
|
|
11
11
|
'no-inner-declarations': 'error',
|
|
12
12
|
'no-invalid-regexp': 'error',
|
|
13
13
|
'no-new-native-nonconstructor': 'error',
|
package/airbnb/es6.js
CHANGED
|
@@ -4,15 +4,14 @@ export const es6 = {
|
|
|
4
4
|
requireReturnForObjectLiteral: false,
|
|
5
5
|
},
|
|
6
6
|
],
|
|
7
|
-
'arrow-spacing': ['error', { before: true, after: true }],
|
|
8
|
-
'generator-star-spacing': ['error', { before: false, after: true }],
|
|
9
|
-
'no-confusing-arrow': [
|
|
7
|
+
'@stylistic/arrow-spacing': ['error', { before: true, after: true }],
|
|
8
|
+
'@stylistic/generator-star-spacing': ['error', { before: false, after: true }],
|
|
9
|
+
'@stylistic/no-confusing-arrow': [
|
|
10
10
|
'error', {
|
|
11
11
|
allowParens: true,
|
|
12
12
|
},
|
|
13
13
|
],
|
|
14
14
|
'no-duplicate-imports': 'off',
|
|
15
|
-
'no-new-symbol': 'error',
|
|
16
15
|
'no-restricted-exports': [
|
|
17
16
|
'error', {
|
|
18
17
|
restrictedNamedExports: [
|
|
@@ -73,8 +72,8 @@ export const es6 = {
|
|
|
73
72
|
'prefer-rest-params': 'error',
|
|
74
73
|
'prefer-spread': 'error',
|
|
75
74
|
'prefer-template': 'error',
|
|
76
|
-
'rest-spread-spacing': ['error', 'never'],
|
|
75
|
+
'@stylistic/rest-spread-spacing': ['error', 'never'],
|
|
77
76
|
'symbol-description': 'error',
|
|
78
|
-
'template-curly-spacing': 'error',
|
|
79
|
-
'yield-star-spacing': ['error', 'after'],
|
|
77
|
+
'@stylistic/template-curly-spacing': 'error',
|
|
78
|
+
'@stylistic/yield-star-spacing': ['error', 'after'],
|
|
80
79
|
};
|
package/airbnb/style.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
export const style = {
|
|
2
2
|
camelcase: ['error', { properties: 'never', ignoreDestructuring: false }],
|
|
3
3
|
'func-names': 'warn',
|
|
4
|
-
'
|
|
5
|
-
'error', {
|
|
6
|
-
before: 'always',
|
|
7
|
-
after: 'always',
|
|
8
|
-
},
|
|
9
|
-
],
|
|
4
|
+
'@stylistic/padding-line-between-statements': ['error', { blankLine: 'always', prev: 'directive', next: '*' }],
|
|
10
5
|
'max-lines-per-function': [
|
|
11
6
|
'off', {
|
|
12
7
|
max: 50,
|
|
@@ -28,8 +23,7 @@ export const style = {
|
|
|
28
23
|
'no-lonely-if': 'error',
|
|
29
24
|
'no-multi-assign': ['error'],
|
|
30
25
|
'no-nested-ternary': 'error',
|
|
31
|
-
'no-
|
|
32
|
-
'no-spaced-func': 'off',
|
|
26
|
+
'@stylistic/no-spaced-func': 'off',
|
|
33
27
|
'no-underscore-dangle': [
|
|
34
28
|
'error', {
|
|
35
29
|
allow: [],
|
package/base.js
CHANGED
|
@@ -4,6 +4,8 @@ import array from 'eslint-plugin-array-func';
|
|
|
4
4
|
import stylistic from '@stylistic/eslint-plugin';
|
|
5
5
|
import eslintJs from '@eslint/js';
|
|
6
6
|
import { configs as regexpConfig } from 'eslint-plugin-regexp';
|
|
7
|
+
import eslintPluginUnicorn from 'eslint-plugin-unicorn';
|
|
8
|
+
import { defineConfig } from 'eslint/config';
|
|
7
9
|
import { rules as PromiseRules } from './plugin-rules/promise.js';
|
|
8
10
|
import { rules as StyleRules } from './plugin-rules/stylistic.js';
|
|
9
11
|
import { bestPractices } from './airbnb/best-practices.js';
|
|
@@ -12,8 +14,9 @@ import { style } from './airbnb/style.js';
|
|
|
12
14
|
import { variables } from './airbnb/variables.js';
|
|
13
15
|
import { es6 } from './airbnb/es6.js';
|
|
14
16
|
import { imports } from './plugin-rules/imports.js';
|
|
17
|
+
import { rules as UnicornRules } from './plugin-rules/unicorn.js';
|
|
15
18
|
|
|
16
|
-
export default [
|
|
19
|
+
export default defineConfig([
|
|
17
20
|
{
|
|
18
21
|
languageOptions: {
|
|
19
22
|
ecmaVersion: 2023,
|
|
@@ -22,11 +25,12 @@ export default [
|
|
|
22
25
|
ecmaVersion: 2023,
|
|
23
26
|
},
|
|
24
27
|
},
|
|
25
|
-
plugins: {
|
|
28
|
+
plugins: { promise },
|
|
26
29
|
linterOptions: {
|
|
27
30
|
reportUnusedDisableDirectives: true,
|
|
28
31
|
},
|
|
29
32
|
settings: {
|
|
33
|
+
'import/resolver': 'typescript', // Supports "exports" in package.json
|
|
30
34
|
'import/parsers': {
|
|
31
35
|
espree: ['.js', '.cjs', '.mjs', '.jsx'],
|
|
32
36
|
},
|
|
@@ -46,8 +50,10 @@ export default [
|
|
|
46
50
|
semi: true,
|
|
47
51
|
}),
|
|
48
52
|
eslintJs.configs.recommended,
|
|
53
|
+
importPlugin.flatConfigs.recommended,
|
|
49
54
|
array.configs.all,
|
|
50
55
|
regexpConfig['flat/recommended'],
|
|
56
|
+
eslintPluginUnicorn.configs.recommended,
|
|
51
57
|
{
|
|
52
58
|
rules: {
|
|
53
59
|
...bestPractices,
|
|
@@ -66,6 +72,7 @@ export default [
|
|
|
66
72
|
'array-func/prefer-array-from': 'off',
|
|
67
73
|
...PromiseRules,
|
|
68
74
|
...StyleRules,
|
|
75
|
+
...UnicornRules,
|
|
69
76
|
},
|
|
70
77
|
},
|
|
71
|
-
];
|
|
78
|
+
]);
|
package/browser.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import globals from 'globals';
|
|
2
|
+
import { defineConfig } from 'eslint/config';
|
|
2
3
|
import base from './base.js';
|
|
3
4
|
|
|
4
|
-
export default [
|
|
5
|
+
export default defineConfig([
|
|
5
6
|
...base,
|
|
6
7
|
{
|
|
7
8
|
languageOptions: {
|
|
@@ -10,4 +11,4 @@ export default [
|
|
|
10
11
|
},
|
|
11
12
|
},
|
|
12
13
|
},
|
|
13
|
-
];
|
|
14
|
+
]);
|
package/nodejs.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import node from 'eslint-plugin-n/configs/recommended-module.js';
|
|
2
2
|
import globals from 'globals';
|
|
3
|
+
import { defineConfig } from 'eslint/config';
|
|
3
4
|
import base from './base.js';
|
|
4
5
|
|
|
5
|
-
export default [
|
|
6
|
+
export default defineConfig([
|
|
6
7
|
...base,
|
|
7
8
|
node,
|
|
8
9
|
{
|
|
@@ -20,4 +21,4 @@ export default [
|
|
|
20
21
|
'import/extensions': ['error', 'always', { ignorePackages: true }],
|
|
21
22
|
},
|
|
22
23
|
},
|
|
23
|
-
];
|
|
24
|
+
]);
|
package/package.json
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@egs33/eslint-config",
|
|
3
3
|
"description": "eslint config for me",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.2.0",
|
|
5
5
|
"author": "egs33",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@eslint/js": "^9.
|
|
9
|
-
"@stylistic/eslint-plugin": "^5.
|
|
10
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
11
|
-
"@typescript-eslint/parser": "^8.
|
|
12
|
-
"eslint-
|
|
8
|
+
"@eslint/js": "^9.39.2",
|
|
9
|
+
"@stylistic/eslint-plugin": "^5.6.1",
|
|
10
|
+
"@typescript-eslint/eslint-plugin": "^8.51.0",
|
|
11
|
+
"@typescript-eslint/parser": "^8.51.0",
|
|
12
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
13
|
+
"eslint-plugin-array-func": "^5.1.0",
|
|
13
14
|
"eslint-plugin-import": "^2.31.0",
|
|
14
|
-
"eslint-plugin-n": "^17.
|
|
15
|
+
"eslint-plugin-n": "^17.23.1",
|
|
15
16
|
"eslint-plugin-promise": "^7.1.0",
|
|
16
17
|
"eslint-plugin-regexp": "^2.6.0",
|
|
17
|
-
"
|
|
18
|
+
"eslint-plugin-unicorn": "^62.0.0",
|
|
19
|
+
"globals": "^16.5.0"
|
|
18
20
|
},
|
|
19
21
|
"devDependencies": {
|
|
20
|
-
"eslint": "^9.
|
|
21
|
-
"svelte-eslint-parser": "^1.1
|
|
22
|
-
"typescript": "^5.
|
|
23
|
-
"typescript-eslint": "^8.
|
|
22
|
+
"eslint": "^9.39.2",
|
|
23
|
+
"svelte-eslint-parser": "^1.4.1",
|
|
24
|
+
"typescript": "^5.9.3",
|
|
25
|
+
"typescript-eslint": "^8.51.0"
|
|
24
26
|
},
|
|
25
27
|
"engines": {
|
|
26
28
|
"node": ">=20"
|
|
@@ -45,12 +47,16 @@
|
|
|
45
47
|
"license": "MIT",
|
|
46
48
|
"main": "nodejs.js",
|
|
47
49
|
"peerDependencies": {
|
|
48
|
-
"eslint": "^9.
|
|
49
|
-
"
|
|
50
|
+
"eslint": "^9.39.2",
|
|
51
|
+
"eslint-plugin-svelte": "^3.13.1",
|
|
52
|
+
"svelte-eslint-parser": "^1.4.1",
|
|
50
53
|
"typescript": "^5.6.3",
|
|
51
|
-
"typescript-eslint": "^8.
|
|
54
|
+
"typescript-eslint": "^8.51.0"
|
|
52
55
|
},
|
|
53
56
|
"peerDependenciesMeta": {
|
|
57
|
+
"eslint-plugin-svelte": {
|
|
58
|
+
"optional": true
|
|
59
|
+
},
|
|
54
60
|
"typescript-eslint": {
|
|
55
61
|
"optional": true
|
|
56
62
|
},
|
package/plugin-rules/imports.js
CHANGED
|
@@ -91,11 +91,6 @@ export const imports = {
|
|
|
91
91
|
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/first.md
|
|
92
92
|
'import/first': 'error',
|
|
93
93
|
|
|
94
|
-
// disallow non-import statements appearing before import statements
|
|
95
|
-
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/imports-first.md
|
|
96
|
-
// deprecated: use `import/first`
|
|
97
|
-
'import/imports-first': 'off',
|
|
98
|
-
|
|
99
94
|
// disallow duplicate imports
|
|
100
95
|
// https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
|
|
101
96
|
'import/no-duplicates': 'error',
|
|
@@ -132,5 +132,5 @@ export const rules = {
|
|
|
132
132
|
'@stylistic/switch-colon-spacing': ['error', { after: true, before: false }],
|
|
133
133
|
'@stylistic/wrap-regex': 'off',
|
|
134
134
|
'@stylistic/array-bracket-newline': 'error',
|
|
135
|
-
'@stylistic/no-extra-parens': ['error', 'all', { nestedBinaryExpressions: false,
|
|
135
|
+
'@stylistic/no-extra-parens': ['error', 'all', { nestedBinaryExpressions: false, ignoredNodes: ['ArrowFunctionExpression[body.type=ConditionalExpression]'] }],
|
|
136
136
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const rules = {
|
|
2
|
+
'unicorn/better-regex': 'error',
|
|
3
|
+
'unicorn/custom-error-definition': 'error',
|
|
4
|
+
'unicorn/expiring-todo-comments': 'off',
|
|
5
|
+
'unicorn/import-style': 'off',
|
|
6
|
+
'unicorn/no-array-callback-reference': 'off',
|
|
7
|
+
'unicorn/no-array-reduce': 'off',
|
|
8
|
+
'unicorn/no-await-expression-member': 'off',
|
|
9
|
+
'no-nested-ternary': 'off',
|
|
10
|
+
'unicorn/no-nested-ternary': 'error',
|
|
11
|
+
'unicorn/no-null': 'off',
|
|
12
|
+
'unicorn/no-typeof-undefined': 'off',
|
|
13
|
+
'unicorn/prefer-import-meta-properties': 'error',
|
|
14
|
+
'unicorn/prefer-ternary': 'off',
|
|
15
|
+
'unicorn/prevent-abbreviations': 'off',
|
|
16
|
+
};
|
package/typescript-base.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
// eslint-disable-next-line import/no-unresolved
|
|
2
1
|
import tseslint from 'typescript-eslint';
|
|
2
|
+
import importPlugin from 'eslint-plugin-import';
|
|
3
|
+
import { defineConfig } from 'eslint/config';
|
|
3
4
|
import base from './base.js';
|
|
4
5
|
|
|
5
|
-
const config = [
|
|
6
|
+
const config = defineConfig([
|
|
6
7
|
...base,
|
|
7
8
|
...tseslint.configs.strictTypeChecked,
|
|
8
9
|
...tseslint.configs.stylisticTypeChecked,
|
|
10
|
+
importPlugin.flatConfigs.typescript,
|
|
9
11
|
{
|
|
10
12
|
languageOptions: {
|
|
11
13
|
parserOptions: {
|
|
@@ -61,7 +63,6 @@ const config = [
|
|
|
61
63
|
'@typescript-eslint/no-unused-vars': ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: true }],
|
|
62
64
|
'require-await': 'off',
|
|
63
65
|
'@typescript-eslint/require-await': 'off',
|
|
64
|
-
'no-return-await': 'off',
|
|
65
66
|
'@typescript-eslint/return-await': ['error', 'in-try-catch'],
|
|
66
67
|
|
|
67
68
|
'@typescript-eslint/method-signature-style': ['error', 'property'],
|
|
@@ -80,6 +81,6 @@ const config = [
|
|
|
80
81
|
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
|
|
81
82
|
},
|
|
82
83
|
},
|
|
83
|
-
];
|
|
84
|
+
]);
|
|
84
85
|
|
|
85
86
|
export default config;
|
package/typescript-browser.js
CHANGED
package/typescript-node.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
1
2
|
import nodejs from './nodejs.js';
|
|
2
3
|
import typescriptBase from './typescript-base.js';
|
|
3
4
|
|
|
4
|
-
export default [
|
|
5
|
+
export default defineConfig([
|
|
5
6
|
...nodejs,
|
|
6
7
|
...typescriptBase,
|
|
7
8
|
{
|
|
@@ -9,4 +10,4 @@ export default [
|
|
|
9
10
|
'n/no-missing-import': 'off',
|
|
10
11
|
},
|
|
11
12
|
},
|
|
12
|
-
];
|
|
13
|
+
]);
|
package/typescript-svelte.js
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
import svelteParser from 'svelte-eslint-parser';
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import tseslint from 'typescript-eslint';
|
|
4
|
+
import svelte from 'eslint-plugin-svelte';
|
|
5
|
+
import { defineConfig } from 'eslint/config';
|
|
4
6
|
import typescriptBrowser from './typescript-browser.js';
|
|
5
7
|
|
|
6
|
-
export default [
|
|
8
|
+
export default defineConfig([
|
|
7
9
|
...typescriptBrowser,
|
|
10
|
+
...svelte.configs.recommended,
|
|
8
11
|
{
|
|
9
12
|
languageOptions: {
|
|
10
13
|
parser: svelteParser,
|
|
11
14
|
parserOptions: {
|
|
12
15
|
parser: tseslint.parser,
|
|
13
|
-
|
|
16
|
+
projectService: true,
|
|
14
17
|
extraFileExtensions: ['.svelte'],
|
|
15
18
|
},
|
|
16
19
|
},
|
|
17
|
-
settings: {
|
|
18
|
-
'import/resolver': {
|
|
19
|
-
typescript: {
|
|
20
|
-
project: './tsconfig.eslint.json',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
20
|
rules: {
|
|
25
21
|
'import/no-mutable-exports': 'off',
|
|
26
22
|
'import/no-named-as-default': 'off',
|
|
@@ -97,4 +93,4 @@ export default [
|
|
|
97
93
|
'svelte/system': 'error',
|
|
98
94
|
},
|
|
99
95
|
},
|
|
100
|
-
];
|
|
96
|
+
]);
|