@ivanmaxlogiudice/eslint-config 1.0.0-beta.2 → 1.0.0-beta.4
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/README.md +63 -2
- package/index.cjs +14 -15
- package/package.json +12 -12
- package/src/js.js +2 -2
- package/src/jsonc.js +5 -5
- package/src/typescript.js +2 -3
- package/src/vue.js +4 -4
package/README.md
CHANGED
|
@@ -20,10 +20,9 @@ pnpm add -D @ivanmaxlogiudice/eslint-config
|
|
|
20
20
|
## Usage
|
|
21
21
|
```js
|
|
22
22
|
// eslint.config.js
|
|
23
|
-
import { defineFlatConfig } from 'eslint-define-config'
|
|
24
23
|
import { all } from '@ivanmaxlogiudice/eslint-config'
|
|
25
24
|
|
|
26
|
-
export default
|
|
25
|
+
export default all
|
|
27
26
|
```
|
|
28
27
|
|
|
29
28
|
### Custom Config
|
|
@@ -40,6 +39,68 @@ export default config(
|
|
|
40
39
|
)
|
|
41
40
|
```
|
|
42
41
|
|
|
42
|
+
### VSCode
|
|
43
|
+
|
|
44
|
+
```jsonc
|
|
45
|
+
{
|
|
46
|
+
"eslint.experimental.useFlatConfig": true
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### VSCode support for auto fix
|
|
51
|
+
Install [VS Code ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
|
|
52
|
+
|
|
53
|
+
Add the following settings to your `settings.json`:
|
|
54
|
+
|
|
55
|
+
```jsonc
|
|
56
|
+
{
|
|
57
|
+
"prettier.enable": false,
|
|
58
|
+
"editor.formatOnSave": false,
|
|
59
|
+
"editor.codeActionsOnSave": {
|
|
60
|
+
"source.fixAll.eslint": true,
|
|
61
|
+
"source.organizeImports": false,
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
// The following is optional.
|
|
65
|
+
// It's better to put under project setting `.vscode/settings.json`
|
|
66
|
+
// to avoid conflicts with working with different eslint configs
|
|
67
|
+
// that does not support all formats.
|
|
68
|
+
"eslint.validate": [
|
|
69
|
+
"javascript",
|
|
70
|
+
"javascriptreact",
|
|
71
|
+
"typescript",
|
|
72
|
+
"typescriptreact",
|
|
73
|
+
"vue",
|
|
74
|
+
"html",
|
|
75
|
+
"markdown",
|
|
76
|
+
"json",
|
|
77
|
+
"jsonc",
|
|
78
|
+
"yaml"
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Lint Staged
|
|
84
|
+
|
|
85
|
+
If you want to apply lint and auto-fix before every commit, you can add the following to your `package.json`:
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"simple-git-hooks": {
|
|
90
|
+
"pre-commit": "pnpm lint-staged"
|
|
91
|
+
},
|
|
92
|
+
"lint-staged": {
|
|
93
|
+
"*": "eslint --fix"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
and then
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
pnpm i -D lint-staged simple-git-hooks
|
|
102
|
+
```
|
|
103
|
+
|
|
43
104
|
## License
|
|
44
105
|
|
|
45
106
|
[MIT](./LICENSE) License © 2022-PRESENT [Iván M. Lo Giudice](https://github.com/ivanmaxlogiudice)
|
package/index.cjs
CHANGED
|
@@ -214,6 +214,7 @@ var js = [
|
|
|
214
214
|
}],
|
|
215
215
|
"comma-style": ["error", "last"],
|
|
216
216
|
"curly": ["error", "multi-or-nest", "consistent"],
|
|
217
|
+
"dot-notation": "warn",
|
|
217
218
|
"eqeqeq": ["error", "smart"],
|
|
218
219
|
"func-call-spacing": ["error", "never"],
|
|
219
220
|
"indent": ["error", 4, {
|
|
@@ -294,7 +295,6 @@ var js = [
|
|
|
294
295
|
"no-lonely-if": "error",
|
|
295
296
|
"no-multi-spaces": "error",
|
|
296
297
|
"no-multi-str": "error",
|
|
297
|
-
"no-return-assign": ["error", "always"],
|
|
298
298
|
"no-return-await": "warn",
|
|
299
299
|
"no-restricted-globals": [
|
|
300
300
|
"error",
|
|
@@ -407,6 +407,7 @@ var imports = [
|
|
|
407
407
|
}],
|
|
408
408
|
pathGroupsExcludedImportTypes: ["type"]
|
|
409
409
|
}],
|
|
410
|
+
"import/no-self-import": "error",
|
|
410
411
|
// off
|
|
411
412
|
"import/namespace": "off",
|
|
412
413
|
"import/no-absolute-path": "off",
|
|
@@ -468,7 +469,6 @@ var unicorn = [
|
|
|
468
469
|
"unicorn/no-new-array": "error",
|
|
469
470
|
"unicorn/no-new-buffer": "error",
|
|
470
471
|
"unicorn/no-unnecessary-await": "error",
|
|
471
|
-
"unicorn/no-unsafe-regex": "off",
|
|
472
472
|
"unicorn/number-literal-case": "error",
|
|
473
473
|
"unicorn/prefer-add-event-listener": "error",
|
|
474
474
|
"unicorn/prefer-array-find": "error",
|
|
@@ -599,13 +599,13 @@ var pkgOrder = [
|
|
|
599
599
|
},
|
|
600
600
|
{
|
|
601
601
|
pathPattern: "^exports.*$",
|
|
602
|
-
order: [
|
|
603
|
-
"types",
|
|
604
|
-
"require",
|
|
605
|
-
"import"
|
|
606
|
-
]
|
|
602
|
+
order: ["types", "require", "import", "default"]
|
|
607
603
|
}
|
|
608
|
-
]
|
|
604
|
+
],
|
|
605
|
+
"jsonc/sort-array-values": ["error", {
|
|
606
|
+
pathPattern: "^files$",
|
|
607
|
+
order: { type: "asc" }
|
|
608
|
+
}]
|
|
609
609
|
}
|
|
610
610
|
}
|
|
611
611
|
];
|
|
@@ -666,7 +666,7 @@ var typescript = [
|
|
|
666
666
|
},
|
|
667
667
|
rules: {
|
|
668
668
|
...import_eslint_plugin2.default.configs["eslint-recommended"].overrides[0].rules,
|
|
669
|
-
...import_eslint_plugin2.default.configs
|
|
669
|
+
...import_eslint_plugin2.default.configs.strict.rules,
|
|
670
670
|
"@typescript-eslint/ban-ts-comment": ["error", {
|
|
671
671
|
"ts-ignore": "allow-with-description"
|
|
672
672
|
}],
|
|
@@ -743,11 +743,11 @@ var typescript = [
|
|
|
743
743
|
"antfu/generic-spacing": "error",
|
|
744
744
|
"antfu/no-cjs-exports": "error",
|
|
745
745
|
"antfu/no-ts-export-equal": "error",
|
|
746
|
+
"antfu/no-const-enum": "error",
|
|
746
747
|
// off
|
|
747
748
|
"import/named": "off",
|
|
748
749
|
"@typescript-eslint/no-unused-vars": "off",
|
|
749
750
|
// handled by unused-imports/no-unused-imports
|
|
750
|
-
"@typescript-eslint/ban-types": "off",
|
|
751
751
|
"@typescript-eslint/no-explicit-any": "off",
|
|
752
752
|
"@typescript-eslint/no-non-null-assertion": "off",
|
|
753
753
|
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
@@ -755,7 +755,6 @@ var typescript = [
|
|
|
755
755
|
"@typescript-eslint/naming-convention": "off",
|
|
756
756
|
"@typescript-eslint/explicit-function-return-type": "off",
|
|
757
757
|
"@typescript-eslint/explicit-member-accessibility": "off",
|
|
758
|
-
"@typescript-eslint/no-parameter-properties": "off",
|
|
759
758
|
"@typescript-eslint/ban-ts-ignore": "off",
|
|
760
759
|
"@typescript-eslint/no-empty-function": "off",
|
|
761
760
|
"@typescript-eslint/triple-slash-reference": "off"
|
|
@@ -940,16 +939,16 @@ var vueCustomRules = {
|
|
|
940
939
|
"vue/template-curly-spacing": "error"
|
|
941
940
|
};
|
|
942
941
|
var vue3Rules = {
|
|
943
|
-
...import_eslint_plugin_vue.default.configs
|
|
942
|
+
...import_eslint_plugin_vue.default.configs.base.rules,
|
|
944
943
|
...import_eslint_plugin_vue.default.configs["vue3-essential"].rules,
|
|
945
944
|
...import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules,
|
|
946
945
|
...import_eslint_plugin_vue.default.configs["vue3-recommended"].rules
|
|
947
946
|
};
|
|
948
947
|
var vue2Rules = {
|
|
949
|
-
...import_eslint_plugin_vue.default.configs
|
|
950
|
-
...import_eslint_plugin_vue.default.configs
|
|
948
|
+
...import_eslint_plugin_vue.default.configs.base.rules,
|
|
949
|
+
...import_eslint_plugin_vue.default.configs.essential.rules,
|
|
951
950
|
...import_eslint_plugin_vue.default.configs["strongly-recommended"].rules,
|
|
952
|
-
...import_eslint_plugin_vue.default.configs
|
|
951
|
+
...import_eslint_plugin_vue.default.configs.recommended.rules
|
|
953
952
|
};
|
|
954
953
|
var vue = [
|
|
955
954
|
{
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ivanmaxlogiudice/eslint-config",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
4
|
-
"packageManager": "pnpm@8.6.
|
|
3
|
+
"version": "1.0.0-beta.4",
|
|
4
|
+
"packageManager": "pnpm@8.6.10",
|
|
5
5
|
"description": "Personal ESLint config",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"url": "git+https://github.com/ivanmaxlogiudice/eslint-config.git"
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
|
-
"index.js",
|
|
18
17
|
"index.cjs",
|
|
18
|
+
"index.js",
|
|
19
19
|
"src"
|
|
20
20
|
],
|
|
21
21
|
"main": "./index.js",
|
|
@@ -31,20 +31,20 @@
|
|
|
31
31
|
"eslint": "^8.0.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@eslint/js": "^8.
|
|
35
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
36
|
-
"@typescript-eslint/parser": "^
|
|
34
|
+
"@eslint/js": "^8.45.0",
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^6.1.0",
|
|
36
|
+
"@typescript-eslint/parser": "^6.1.0",
|
|
37
37
|
"eslint-config-standard": "^17.1.0",
|
|
38
38
|
"eslint-define-config": "^1.21.0",
|
|
39
|
-
"eslint-plugin-antfu": "^0.39.
|
|
39
|
+
"eslint-plugin-antfu": "^0.39.8",
|
|
40
40
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
41
41
|
"eslint-plugin-import": "^2.27.5",
|
|
42
42
|
"eslint-plugin-jsonc": "^2.9.0",
|
|
43
43
|
"eslint-plugin-markdown": "^3.0.0",
|
|
44
44
|
"eslint-plugin-n": "^16.0.1",
|
|
45
45
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
46
|
-
"eslint-plugin-unicorn": "^
|
|
47
|
-
"eslint-plugin-unused-imports": "^
|
|
46
|
+
"eslint-plugin-unicorn": "^48.0.0",
|
|
47
|
+
"eslint-plugin-unused-imports": "^3.0.0",
|
|
48
48
|
"eslint-plugin-vue": "^9.15.1",
|
|
49
49
|
"eslint-plugin-yml": "^1.8.0",
|
|
50
50
|
"globals": "^13.20.0",
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
"yaml-eslint-parser": "^1.2.2"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@types/node": "^20.
|
|
57
|
+
"@types/node": "^20.4.4",
|
|
58
58
|
"bumpp": "^9.1.1",
|
|
59
|
-
"eslint": "^8.
|
|
59
|
+
"eslint": "^8.45.0",
|
|
60
60
|
"tsup": "^7.1.0",
|
|
61
|
-
"typescript": "^5.1.
|
|
61
|
+
"typescript": "^5.1.6"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": ">=16.14.0"
|
package/src/js.js
CHANGED
|
@@ -48,6 +48,7 @@ export const js = [
|
|
|
48
48
|
}],
|
|
49
49
|
'comma-style': ['error', 'last'],
|
|
50
50
|
'curly': ['error', 'multi-or-nest', 'consistent'],
|
|
51
|
+
'dot-notation': 'warn',
|
|
51
52
|
'eqeqeq': ['error', 'smart'],
|
|
52
53
|
'func-call-spacing': ['error', 'never'],
|
|
53
54
|
'indent': ['error', 4, {
|
|
@@ -129,7 +130,6 @@ export const js = [
|
|
|
129
130
|
'no-lonely-if': 'error',
|
|
130
131
|
'no-multi-spaces': 'error',
|
|
131
132
|
'no-multi-str': 'error',
|
|
132
|
-
'no-return-assign': ['error', 'always'],
|
|
133
133
|
'no-return-await': 'warn',
|
|
134
134
|
'no-restricted-globals': ['error',
|
|
135
135
|
{ name: 'global', message: 'Use `globalThis` instead.' },
|
|
@@ -244,6 +244,7 @@ export const imports = [
|
|
|
244
244
|
}],
|
|
245
245
|
pathGroupsExcludedImportTypes: ['type'],
|
|
246
246
|
}],
|
|
247
|
+
'import/no-self-import': 'error',
|
|
247
248
|
|
|
248
249
|
// off
|
|
249
250
|
'import/namespace': 'off',
|
|
@@ -310,7 +311,6 @@ export const unicorn = [
|
|
|
310
311
|
'unicorn/no-new-array': 'error',
|
|
311
312
|
'unicorn/no-new-buffer': 'error',
|
|
312
313
|
'unicorn/no-unnecessary-await': 'error',
|
|
313
|
-
'unicorn/no-unsafe-regex': 'off',
|
|
314
314
|
'unicorn/number-literal-case': 'error',
|
|
315
315
|
'unicorn/prefer-add-event-listener': 'error',
|
|
316
316
|
'unicorn/prefer-array-find': 'error',
|
package/src/jsonc.js
CHANGED
|
@@ -96,13 +96,13 @@ export const pkgOrder = [
|
|
|
96
96
|
},
|
|
97
97
|
{
|
|
98
98
|
pathPattern: '^exports.*$',
|
|
99
|
-
order: [
|
|
100
|
-
'types',
|
|
101
|
-
'require',
|
|
102
|
-
'import',
|
|
103
|
-
],
|
|
99
|
+
order: ['types', 'require', 'import', 'default'],
|
|
104
100
|
},
|
|
105
101
|
],
|
|
102
|
+
'jsonc/sort-array-values': ['error', {
|
|
103
|
+
pathPattern: '^files$',
|
|
104
|
+
order: { type: 'asc' },
|
|
105
|
+
}],
|
|
106
106
|
},
|
|
107
107
|
},
|
|
108
108
|
]
|
package/src/typescript.js
CHANGED
|
@@ -19,7 +19,7 @@ export const typescript = [
|
|
|
19
19
|
},
|
|
20
20
|
rules: {
|
|
21
21
|
...tsPlugin.configs['eslint-recommended'].overrides[0].rules,
|
|
22
|
-
...tsPlugin.configs
|
|
22
|
+
...tsPlugin.configs.strict.rules,
|
|
23
23
|
|
|
24
24
|
'@typescript-eslint/ban-ts-comment': ['error', {
|
|
25
25
|
'ts-ignore': 'allow-with-description',
|
|
@@ -114,12 +114,12 @@ export const typescript = [
|
|
|
114
114
|
'antfu/generic-spacing': 'error',
|
|
115
115
|
'antfu/no-cjs-exports': 'error',
|
|
116
116
|
'antfu/no-ts-export-equal': 'error',
|
|
117
|
+
'antfu/no-const-enum': 'error',
|
|
117
118
|
|
|
118
119
|
// off
|
|
119
120
|
'import/named': 'off',
|
|
120
121
|
|
|
121
122
|
'@typescript-eslint/no-unused-vars': 'off', // handled by unused-imports/no-unused-imports
|
|
122
|
-
'@typescript-eslint/ban-types': 'off',
|
|
123
123
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
124
124
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
125
125
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
@@ -127,7 +127,6 @@ export const typescript = [
|
|
|
127
127
|
'@typescript-eslint/naming-convention': 'off',
|
|
128
128
|
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
129
129
|
'@typescript-eslint/explicit-member-accessibility': 'off',
|
|
130
|
-
'@typescript-eslint/no-parameter-properties': 'off',
|
|
131
130
|
'@typescript-eslint/ban-ts-ignore': 'off',
|
|
132
131
|
'@typescript-eslint/no-empty-function': 'off',
|
|
133
132
|
'@typescript-eslint/triple-slash-reference': 'off',
|
package/src/vue.js
CHANGED
|
@@ -146,7 +146,7 @@ const vueCustomRules = {
|
|
|
146
146
|
|
|
147
147
|
/** @type {import('eslint-define-config').Rules} */
|
|
148
148
|
const vue3Rules = {
|
|
149
|
-
...vuePlugin.configs
|
|
149
|
+
...vuePlugin.configs.base.rules,
|
|
150
150
|
...vuePlugin.configs['vue3-essential'].rules,
|
|
151
151
|
...vuePlugin.configs['vue3-strongly-recommended'].rules,
|
|
152
152
|
...vuePlugin.configs['vue3-recommended'].rules,
|
|
@@ -154,10 +154,10 @@ const vue3Rules = {
|
|
|
154
154
|
|
|
155
155
|
/** @type {import('eslint-define-config').Rules} */
|
|
156
156
|
const vue2Rules = {
|
|
157
|
-
...vuePlugin.configs
|
|
158
|
-
...vuePlugin.configs
|
|
157
|
+
...vuePlugin.configs.base.rules,
|
|
158
|
+
...vuePlugin.configs.essential.rules,
|
|
159
159
|
...vuePlugin.configs['strongly-recommended'].rules,
|
|
160
|
-
...vuePlugin.configs
|
|
160
|
+
...vuePlugin.configs.recommended.rules,
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
/** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
|