@paratco/eslint-config 0.1.0 → 0.3.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 +6 -80
- package/package.json +17 -11
- package/src/configs/base.js +25 -0
- package/src/configs/react.js +58 -0
- /package/{lints → src/lints}/react/index.js +0 -0
- /package/{lints → src/lints}/typescript/index.js +0 -0
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 './src/lints/typescript/index.js';
|
|
16
|
+
import reactRules from './src/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,81 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import globals from "globals";
|
|
1
|
+
import baseConfig from "./src/configs/base.js";
|
|
2
|
+
import reactConfig from "./src/configs/react.js";
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import eslintConfigPrettier from "eslint-config-prettier";
|
|
10
|
-
|
|
11
|
-
// Custom Rules
|
|
12
|
-
import typescriptRules from "./lints/typescript/index.js";
|
|
13
|
-
import reactRules from "./lints/react/index.js";
|
|
14
|
-
|
|
15
|
-
export default tseslint.config(
|
|
16
|
-
eslint.configs.recommended,
|
|
17
|
-
...tseslint.configs.strictTypeChecked,
|
|
18
|
-
...tseslint.configs.stylisticTypeChecked,
|
|
19
|
-
|
|
20
|
-
// TypeScript Rules
|
|
21
|
-
{
|
|
22
|
-
files: ["**/*.{ts,tsx}"],
|
|
23
|
-
languageOptions: {
|
|
24
|
-
parserOptions: {
|
|
25
|
-
ecmaFeatures: {
|
|
26
|
-
jsx: true
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
globals: {
|
|
30
|
-
...globals.browser
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
rules: {
|
|
34
|
-
...typescriptRules
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
// React Plugin
|
|
39
|
-
{
|
|
40
|
-
files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
|
|
41
|
-
plugins: {
|
|
42
|
-
react: 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
|
-
);
|
|
4
|
+
export default {
|
|
5
|
+
base: baseConfig,
|
|
6
|
+
react: reactConfig
|
|
7
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paratco/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.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
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import eslint from "@eslint/js";
|
|
2
|
+
import tseslint from "typescript-eslint";
|
|
3
|
+
|
|
4
|
+
// Plugins
|
|
5
|
+
import eslintConfigPrettier from "eslint-config-prettier";
|
|
6
|
+
|
|
7
|
+
// Custom Rules
|
|
8
|
+
import typescriptRules from "../lints/typescript/index.js";
|
|
9
|
+
|
|
10
|
+
export default [
|
|
11
|
+
// Set predefined configs
|
|
12
|
+
eslint.configs.recommended,
|
|
13
|
+
...tseslint.configs.strictTypeChecked,
|
|
14
|
+
...tseslint.configs.stylisticTypeChecked,
|
|
15
|
+
|
|
16
|
+
// TypeScript Rules
|
|
17
|
+
{
|
|
18
|
+
files: ["**/*.{ts,tsx}"],
|
|
19
|
+
rules: {
|
|
20
|
+
...typescriptRules
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
eslintConfigPrettier
|
|
25
|
+
];
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import globals from "globals";
|
|
2
|
+
|
|
3
|
+
// Fix plugins compatibility with ESLint 9.x
|
|
4
|
+
import { fixupPluginRules } from "@eslint/compat";
|
|
5
|
+
|
|
6
|
+
// Plugins
|
|
7
|
+
import react from "eslint-plugin-react";
|
|
8
|
+
import reactHooks from "eslint-plugin-react-hooks";
|
|
9
|
+
import reactRefresh from "eslint-plugin-react-refresh";
|
|
10
|
+
|
|
11
|
+
// Custom Rules
|
|
12
|
+
import reactRules from "../lints/react/index.js";
|
|
13
|
+
|
|
14
|
+
export default [
|
|
15
|
+
// Browser Only
|
|
16
|
+
{ languageOptions: { globals: globals.browser } },
|
|
17
|
+
|
|
18
|
+
// Enable JSX
|
|
19
|
+
{ files: ["**/*.tsx"], languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } } },
|
|
20
|
+
|
|
21
|
+
// React Plugin
|
|
22
|
+
{
|
|
23
|
+
files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
|
|
24
|
+
plugins: {
|
|
25
|
+
react: fixupPluginRules(react),
|
|
26
|
+
"react-hooks": reactHooks,
|
|
27
|
+
"react-refresh": reactRefresh
|
|
28
|
+
},
|
|
29
|
+
settings: {
|
|
30
|
+
react: {
|
|
31
|
+
version: "detect"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
languageOptions: {
|
|
35
|
+
parserOptions: {
|
|
36
|
+
ecmaFeatures: {
|
|
37
|
+
jsx: true
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
globals: {
|
|
41
|
+
...globals.browser
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
rules: {
|
|
45
|
+
...reactRules,
|
|
46
|
+
// ...react.configs.recommended.rules,
|
|
47
|
+
...reactHooks.configs.recommended.rules,
|
|
48
|
+
|
|
49
|
+
// Enforce Rules of Hooks
|
|
50
|
+
"react-hooks/rules-of-hooks": ["error"],
|
|
51
|
+
// Verify the list of the dependencies for Hooks like useEffect and similar
|
|
52
|
+
"react-hooks/exhaustive-deps": ["error"],
|
|
53
|
+
|
|
54
|
+
// React Refresh
|
|
55
|
+
"react-refresh/only-export-components": ["warn", { allowConstantExport: true }]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
];
|
|
File without changes
|
|
File without changes
|