@paratco/eslint-config 0.1.0 → 0.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/.prettierrc.json +22 -22
- package/eslint.config.mjs +81 -0
- package/index.js +15 -15
- package/package.json +17 -11
package/.prettierrc.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/prettierrc",
|
|
3
|
-
"printWidth": 120,
|
|
4
|
-
"tabWidth": 2,
|
|
5
|
-
"useTabs": false,
|
|
6
|
-
"semi": true,
|
|
7
|
-
"singleQuote": false,
|
|
8
|
-
"quoteProps": "
|
|
9
|
-
"jsxSingleQuote": false,
|
|
10
|
-
"trailingComma": "none",
|
|
11
|
-
"bracketSpacing": true,
|
|
12
|
-
"bracketSameLine": false,
|
|
13
|
-
"arrowParens": "always",
|
|
14
|
-
"requirePragma": false,
|
|
15
|
-
"insertPragma": false,
|
|
16
|
-
"proseWrap": "preserve",
|
|
17
|
-
"htmlWhitespaceSensitivity": "css",
|
|
18
|
-
"vueIndentScriptAndStyle": false,
|
|
19
|
-
"endOfLine": "lf",
|
|
20
|
-
"embeddedLanguageFormatting": "auto",
|
|
21
|
-
"singleAttributePerLine": false
|
|
22
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/prettierrc",
|
|
3
|
+
"printWidth": 120,
|
|
4
|
+
"tabWidth": 2,
|
|
5
|
+
"useTabs": false,
|
|
6
|
+
"semi": true,
|
|
7
|
+
"singleQuote": false,
|
|
8
|
+
"quoteProps": "as-needed",
|
|
9
|
+
"jsxSingleQuote": false,
|
|
10
|
+
"trailingComma": "none",
|
|
11
|
+
"bracketSpacing": true,
|
|
12
|
+
"bracketSameLine": false,
|
|
13
|
+
"arrowParens": "always",
|
|
14
|
+
"requirePragma": false,
|
|
15
|
+
"insertPragma": false,
|
|
16
|
+
"proseWrap": "preserve",
|
|
17
|
+
"htmlWhitespaceSensitivity": "css",
|
|
18
|
+
"vueIndentScriptAndStyle": false,
|
|
19
|
+
"endOfLine": "lf",
|
|
20
|
+
"embeddedLanguageFormatting": "auto",
|
|
21
|
+
"singleAttributePerLine": false
|
|
22
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import globals from 'globals';
|
|
2
|
+
import eslint from '@eslint/js';
|
|
3
|
+
import tseslint from 'typescript-eslint';
|
|
4
|
+
|
|
5
|
+
// Fix plugins compatibility with ESLint 9.x
|
|
6
|
+
import { fixupRule, fixupPluginRules } from '@eslint/compat';
|
|
7
|
+
|
|
8
|
+
// Plugins
|
|
9
|
+
import react from 'eslint-plugin-react';
|
|
10
|
+
import reactHooks from 'eslint-plugin-react-hooks';
|
|
11
|
+
import reactRefresh from 'eslint-plugin-react-refresh';
|
|
12
|
+
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
13
|
+
|
|
14
|
+
// Custom Rules
|
|
15
|
+
import typescriptRules from './lints/typescript/index.js';
|
|
16
|
+
import reactRules from './lints/react/index.js';
|
|
17
|
+
|
|
18
|
+
export default [
|
|
19
|
+
// Set predefined configs
|
|
20
|
+
eslint.configs.recommended,
|
|
21
|
+
...tseslint.configs.strictTypeChecked,
|
|
22
|
+
...tseslint.configs.stylisticTypeChecked,
|
|
23
|
+
|
|
24
|
+
// Browser Only
|
|
25
|
+
{ languageOptions: { globals: globals.browser } },
|
|
26
|
+
|
|
27
|
+
// Enable JSX
|
|
28
|
+
{ files: ['**/*.tsx'], languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } } },
|
|
29
|
+
|
|
30
|
+
// TypeScript Rules
|
|
31
|
+
{
|
|
32
|
+
files: ['**/*.{ts,tsx}'],
|
|
33
|
+
rules: {
|
|
34
|
+
...typescriptRules
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
// React Plugin
|
|
39
|
+
{
|
|
40
|
+
files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],
|
|
41
|
+
plugins: {
|
|
42
|
+
react: fixupPluginRules(react),
|
|
43
|
+
'react-hooks': reactHooks,
|
|
44
|
+
'react-refresh': reactRefresh
|
|
45
|
+
},
|
|
46
|
+
settings: {
|
|
47
|
+
react: {
|
|
48
|
+
version: 'detect'
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
languageOptions: {
|
|
52
|
+
parserOptions: {
|
|
53
|
+
ecmaFeatures: {
|
|
54
|
+
jsx: true
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
globals: {
|
|
58
|
+
...globals.browser
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
rules: {
|
|
62
|
+
...reactRules,
|
|
63
|
+
// ...react.configs.recommended.rules,
|
|
64
|
+
...reactHooks.configs.recommended.rules,
|
|
65
|
+
|
|
66
|
+
// Enforce Rules of Hooks
|
|
67
|
+
'react-hooks/rules-of-hooks': ['error'],
|
|
68
|
+
// Verify the list of the dependencies for Hooks like useEffect and similar
|
|
69
|
+
'react-hooks/exhaustive-deps': ['error'],
|
|
70
|
+
|
|
71
|
+
// React Refresh
|
|
72
|
+
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }]
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
{
|
|
77
|
+
ignores: ['lints']
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
eslintConfigPrettier
|
|
81
|
+
];
|
package/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import globals from "globals";
|
|
1
2
|
import eslint from "@eslint/js";
|
|
2
3
|
import tseslint from "typescript-eslint";
|
|
3
|
-
|
|
4
|
+
|
|
5
|
+
// Fix plugins compatibility with ESLint 9.x
|
|
6
|
+
import { fixupPluginRules } from "@eslint/compat";
|
|
4
7
|
|
|
5
8
|
// Plugins
|
|
6
9
|
import react from "eslint-plugin-react";
|
|
@@ -12,24 +15,21 @@ import eslintConfigPrettier from "eslint-config-prettier";
|
|
|
12
15
|
import typescriptRules from "./lints/typescript/index.js";
|
|
13
16
|
import reactRules from "./lints/react/index.js";
|
|
14
17
|
|
|
15
|
-
export default
|
|
18
|
+
export default [
|
|
19
|
+
// Set predefined configs
|
|
16
20
|
eslint.configs.recommended,
|
|
17
21
|
...tseslint.configs.strictTypeChecked,
|
|
18
22
|
...tseslint.configs.stylisticTypeChecked,
|
|
19
23
|
|
|
24
|
+
// Browser Only
|
|
25
|
+
{ languageOptions: { globals: globals.browser } },
|
|
26
|
+
|
|
27
|
+
// Enable JSX
|
|
28
|
+
{ files: ["**/*.tsx"], languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } } },
|
|
29
|
+
|
|
20
30
|
// TypeScript Rules
|
|
21
31
|
{
|
|
22
32
|
files: ["**/*.{ts,tsx}"],
|
|
23
|
-
languageOptions: {
|
|
24
|
-
parserOptions: {
|
|
25
|
-
ecmaFeatures: {
|
|
26
|
-
jsx: true
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
globals: {
|
|
30
|
-
...globals.browser
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
33
|
rules: {
|
|
34
34
|
...typescriptRules
|
|
35
35
|
}
|
|
@@ -39,7 +39,7 @@ export default tseslint.config(
|
|
|
39
39
|
{
|
|
40
40
|
files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
|
|
41
41
|
plugins: {
|
|
42
|
-
react: react,
|
|
42
|
+
react: fixupPluginRules(react),
|
|
43
43
|
"react-hooks": reactHooks,
|
|
44
44
|
"react-refresh": reactRefresh
|
|
45
45
|
},
|
|
@@ -69,7 +69,7 @@ export default tseslint.config(
|
|
|
69
69
|
"react-hooks/exhaustive-deps": ["error"],
|
|
70
70
|
|
|
71
71
|
// React Refresh
|
|
72
|
-
"react-refresh/only-export-components": ["warn", {
|
|
72
|
+
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }]
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
|
|
@@ -78,4 +78,4 @@ export default tseslint.config(
|
|
|
78
78
|
},
|
|
79
79
|
|
|
80
80
|
eslintConfigPrettier
|
|
81
|
-
|
|
81
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paratco/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Paratco",
|
|
@@ -17,24 +17,30 @@
|
|
|
17
17
|
"format": "prettier --write src/"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@eslint/
|
|
21
|
-
"eslint": "^
|
|
20
|
+
"@eslint/compat": "^1.0.3",
|
|
21
|
+
"@eslint/js": "^9.4.0",
|
|
22
|
+
"@types/eslint__js": "^8.42.3",
|
|
23
|
+
"eslint": "^9.4.0",
|
|
22
24
|
"eslint-config-prettier": "^9.1.0",
|
|
23
|
-
"eslint-plugin-react": "^7.34.
|
|
25
|
+
"eslint-plugin-react": "^7.34.2",
|
|
24
26
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
25
27
|
"eslint-plugin-react-refresh": "^0.4.7",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
+
"globals": "^15.4.0",
|
|
29
|
+
"prettier": "^3.3.2",
|
|
30
|
+
"typescript-eslint": "^7.13.0"
|
|
28
31
|
},
|
|
29
32
|
"devDependencies": {
|
|
30
|
-
"@eslint/
|
|
31
|
-
"eslint": "^
|
|
33
|
+
"@eslint/compat": "^1.0.3",
|
|
34
|
+
"@eslint/js": "^9.4.0",
|
|
35
|
+
"@types/eslint__js": "^8.42.3",
|
|
36
|
+
"eslint": "^9.4.0",
|
|
32
37
|
"eslint-config-prettier": "^9.1.0",
|
|
33
|
-
"eslint-plugin-react": "^7.34.
|
|
38
|
+
"eslint-plugin-react": "^7.34.2",
|
|
34
39
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
35
40
|
"eslint-plugin-react-refresh": "^0.4.7",
|
|
36
|
-
"
|
|
41
|
+
"globals": "^15.4.0",
|
|
42
|
+
"prettier": "^3.3.2",
|
|
37
43
|
"typescript": "^5.4.5",
|
|
38
|
-
"typescript-eslint": "^7.
|
|
44
|
+
"typescript-eslint": "^7.13.0"
|
|
39
45
|
}
|
|
40
46
|
}
|