@paratco/eslint-config 0.6.4 → 0.7.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/index.js CHANGED
@@ -1,13 +1,13 @@
1
- import baseConfig from "./src/configs/base.js";
2
- import reactConfig from "./src/configs/react.js";
3
- import nodeConfig from "./src/configs/node.js";
4
- import prettierFormatter from "./src/configs/prettierFormatter.js";
5
- import stylisticFormatter from "./src/configs/stylisticFormatter.js";
6
-
7
- export default {
8
- base: baseConfig,
9
- react: reactConfig,
10
- node: nodeConfig,
11
- prettierFormatter,
12
- stylisticFormatter
13
- };
1
+ import baseConfig from "./src/configs/base.js";
2
+ import reactConfig from "./src/configs/react.js";
3
+ import nodeConfig from "./src/configs/node.js";
4
+ import prettierFormatter from "./src/configs/prettierFormatter.js";
5
+ import stylisticFormatter from "./src/configs/stylisticFormatter.js";
6
+
7
+ export default {
8
+ base: baseConfig,
9
+ react: reactConfig,
10
+ node: nodeConfig,
11
+ prettierFormatter,
12
+ stylisticFormatter
13
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paratco/eslint-config",
3
- "version": "0.6.4",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "author": "Paratco",
@@ -29,6 +29,7 @@
29
29
  "@stylistic/eslint-plugin": "^2.3.0",
30
30
  "@types/eslint__js": "^8.42.3",
31
31
  "eslint-config-prettier": "^9.1.0",
32
+ "eslint-plugin-import": "^2.29.1",
32
33
  "eslint-plugin-react": "^7.34.3",
33
34
  "eslint-plugin-react-hooks": "^4.6.2",
34
35
  "eslint-plugin-react-refresh": "^0.4.7",
@@ -1,18 +1,18 @@
1
- import eslint from "@eslint/js";
2
- import tseslint from "typescript-eslint";
3
-
4
- // Custom Rules
5
- import typescriptRules from "../lints/typescript/index.js";
6
-
7
- export default [
8
- // Set predefined configs
9
- eslint.configs.recommended,
10
- ...tseslint.configs.strictTypeChecked,
11
- ...tseslint.configs.stylisticTypeChecked,
12
-
13
- // TypeScript Rules
14
- {
15
- files: ["**/*.{ts,tsx}"],
16
- rules: typescriptRules
17
- }
18
- ];
1
+ import eslint from "@eslint/js";
2
+ import tseslint from "typescript-eslint";
3
+
4
+ // Custom Rules
5
+ import typescriptRules from "../lints/typescript/index.js";
6
+
7
+ export default [
8
+ // Set predefined configs
9
+ eslint.configs.recommended,
10
+ ...tseslint.configs.strictTypeChecked,
11
+ ...tseslint.configs.stylisticTypeChecked,
12
+
13
+ // TypeScript Rules
14
+ {
15
+ files: ["**/*.{ts,tsx}"],
16
+ rules: typescriptRules
17
+ }
18
+ ];
@@ -0,0 +1,25 @@
1
+ import eslintPluginImport from "eslint-plugin-import";
2
+
3
+ // Custom Rules
4
+ import importRules from "../lints/import/index.js";
5
+
6
+ export default [
7
+ // ESLint Plugin Import
8
+ {
9
+ files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
10
+ plugins: {
11
+ import: eslintPluginImport
12
+ },
13
+ settings: {
14
+ "import/resolver": {
15
+ typescript: {
16
+ alwaysTryTypes: true
17
+ }
18
+ }
19
+ },
20
+ rules: {
21
+ ...eslintPluginImport.configs.recommended.rules,
22
+ ...importRules
23
+ }
24
+ }
25
+ ];
@@ -1,9 +1,11 @@
1
- import globals from "globals";
2
- import baseConfig from "./base.js";
3
-
4
- export default [
5
- ...baseConfig,
6
-
7
- // Node Only
8
- { languageOptions: { globals: globals.node } }
9
- ];
1
+ import globals from "globals";
2
+ import baseConfig from "./base.js";
3
+ import importConfig from "./import.js";
4
+
5
+ export default [
6
+ ...baseConfig,
7
+ ...importConfig,
8
+
9
+ // Node Only
10
+ { languageOptions: { globals: globals.node } }
11
+ ];
@@ -1,4 +1,4 @@
1
- // Plugins
2
- import eslintConfigPrettier from "eslint-config-prettier";
3
-
4
- export default [eslintConfigPrettier];
1
+ // Plugins
2
+ import eslintConfigPrettier from "eslint-config-prettier";
3
+
4
+ export default [eslintConfigPrettier];
@@ -1,58 +1,60 @@
1
- import globals from "globals";
2
- import baseConfig from "./base.js";
3
-
4
- // Plugins
5
- import react from "eslint-plugin-react";
6
- import reactHooks from "eslint-plugin-react-hooks";
7
- import reactRefresh from "eslint-plugin-react-refresh";
8
-
9
- // Custom Rules
10
- import reactRules from "../lints/react/index.js";
11
-
12
- export default [
13
- ...baseConfig,
14
-
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: 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
- ];
1
+ import globals from "globals";
2
+ import baseConfig from "./base.js";
3
+ import importConfig from "./import.js";
4
+
5
+ // Plugins
6
+ import react from "eslint-plugin-react";
7
+ import reactHooks from "eslint-plugin-react-hooks";
8
+ import reactRefresh from "eslint-plugin-react-refresh";
9
+
10
+ // Custom Rules
11
+ import reactRules from "../lints/react/index.js";
12
+
13
+ export default [
14
+ ...baseConfig,
15
+ ...importConfig,
16
+
17
+ // Browser Only
18
+ { languageOptions: { globals: globals.browser } },
19
+
20
+ // Enable JSX
21
+ { files: ["**/*.tsx"], languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } } },
22
+
23
+ // React Plugin
24
+ {
25
+ files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
26
+ plugins: {
27
+ react: react,
28
+ "react-hooks": reactHooks,
29
+ "react-refresh": reactRefresh
30
+ },
31
+ settings: {
32
+ react: {
33
+ version: "detect"
34
+ }
35
+ },
36
+ languageOptions: {
37
+ parserOptions: {
38
+ ecmaFeatures: {
39
+ jsx: true
40
+ }
41
+ },
42
+ globals: {
43
+ ...globals.browser
44
+ }
45
+ },
46
+ rules: {
47
+ ...reactRules,
48
+ // ...react.configs.recommended.rules,
49
+ ...reactHooks.configs.recommended.rules,
50
+
51
+ // Enforce Rules of Hooks
52
+ "react-hooks/rules-of-hooks": ["error"],
53
+ // Verify the list of the dependencies for Hooks like useEffect and similar
54
+ "react-hooks/exhaustive-deps": ["error"],
55
+
56
+ // React Refresh
57
+ "react-refresh/only-export-components": ["warn", { allowConstantExport: true }]
58
+ }
59
+ }
60
+ ];
@@ -1,33 +1,33 @@
1
- import stylistic from "@stylistic/eslint-plugin";
2
-
3
- // Custom Rules
4
- import stylisticRules from "../lints/stylistic/index.js";
5
-
6
- export default [
7
- // Stylistic Configs
8
- stylistic.configs.customize({
9
- jsx: true,
10
- arrowParens: true,
11
- flat: true,
12
- blockSpacing: true,
13
- braceStyle: "stroustrup",
14
- commaDangle: "never",
15
- indent: 2,
16
- semi: true,
17
- quotes: "double",
18
- quoteProps: "always"
19
- }),
20
-
21
- // Stylistic Rules
22
- {
23
- files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
24
- languageOptions: {
25
- parserOptions: {
26
- ecmaFeatures: {
27
- jsx: true
28
- }
29
- }
30
- },
31
- rules: stylisticRules
32
- }
33
- ];
1
+ import stylistic from "@stylistic/eslint-plugin";
2
+
3
+ // Custom Rules
4
+ import stylisticRules from "../lints/stylistic/index.js";
5
+
6
+ export default [
7
+ // Stylistic Configs
8
+ stylistic.configs.customize({
9
+ jsx: true,
10
+ arrowParens: true,
11
+ flat: true,
12
+ blockSpacing: true,
13
+ braceStyle: "stroustrup",
14
+ commaDangle: "never",
15
+ indent: 2,
16
+ semi: true,
17
+ quotes: "double",
18
+ quoteProps: "always"
19
+ }),
20
+
21
+ // Stylistic Rules
22
+ {
23
+ files: ["**/*.{js,jsx,mjs,cjs,ts,tsx}"],
24
+ languageOptions: {
25
+ parserOptions: {
26
+ ecmaFeatures: {
27
+ jsx: true
28
+ }
29
+ }
30
+ },
31
+ rules: stylisticRules
32
+ }
33
+ ];
@@ -0,0 +1,159 @@
1
+ export default {
2
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-deprecated.md
3
+ // Forbid imported names marked with @deprecated documentation tag.
4
+ "import/no-deprecated": ["error"],
5
+
6
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-empty-named-blocks.md
7
+ // Forbid empty named import blocks.
8
+ "import/no-empty-named-blocks": ["warn"],
9
+
10
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-extraneous-dependencies.md
11
+ // Forbid the use of extraneous packages.
12
+ "import/no-extraneous-dependencies": [
13
+ "error",
14
+ { devDependencies: false, optionalDependencies: false, peerDependencies: false }
15
+ ],
16
+
17
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-mutable-exports.md
18
+ // Forbid the use of mutable exports with var or let.
19
+ "import/no-mutable-exports": ["error"],
20
+
21
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unused-modules.md
22
+ // Forbid modules without exports, or exports without matching import in another module.
23
+ // TODO: Can be enabled
24
+ "import/no-unused-modules": ["off", { missingExports: true }],
25
+
26
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-amd.md
27
+ // Forbid AMD require and define calls.
28
+ "import/no-amd": ["error"],
29
+
30
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-commonjs.md
31
+ // Forbid CommonJS require calls and module.exports or exports.*.
32
+ "import/no-commonjs": ["error"],
33
+
34
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-import-module-exports.md
35
+ // Forbid import statements with CommonJS module.exports.
36
+ "import/no-import-module-exports": ["warn"],
37
+
38
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-nodejs-modules.md
39
+ // Forbid Node.js builtin modules.
40
+ // TODO: Can enable for front-end
41
+ "import/no-nodejs-modules": ["off"],
42
+
43
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/unambiguous.md
44
+ // Forbid potentially ambiguous parse goal (script vs. module).
45
+ "import/unambiguous": ["error"],
46
+
47
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-absolute-path.md
48
+ // Forbid import of modules using absolute paths.
49
+ "import/no-absolute-path": ["warn"],
50
+
51
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-cycle.md
52
+ // Forbid a module from importing a module with a dependency path back to itself.
53
+ "import/no-cycle": ["error"],
54
+
55
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-dynamic-require.md
56
+ // Forbid require() calls with expressions.
57
+ "import/no-dynamic-require": ["off"],
58
+
59
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-internal-modules.md
60
+ // Forbid importing the submodules of other modules.
61
+ // TODO: Must define in the project
62
+ "import/no-internal-modules": ["off"],
63
+
64
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-relative-packages.md
65
+ // Forbid importing packages through relative paths.
66
+ "import/no-relative-packages": ["warn"],
67
+
68
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-relative-parent-imports.md
69
+ // Forbid importing modules from parent directories.
70
+ "import/no-relative-parent-imports": ["off"],
71
+
72
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-restricted-paths.md
73
+ // Enforce which files can be imported in a given folder.
74
+ // TODO: Can be customized
75
+ // "import/no-restricted-paths": ["off"],
76
+
77
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-self-import.md
78
+ // Forbid a module from importing itself.
79
+ "import/no-self-import": ["error"],
80
+
81
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-useless-path-segments.md
82
+ // Forbid unnecessary path segments in import and require statements.
83
+ "import/no-useless-path-segments": [
84
+ "warn",
85
+ {
86
+ noUselessIndex: true
87
+ }
88
+ ],
89
+
90
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-webpack-loader-syntax.md
91
+ // Forbid webpack loader syntax in imports.
92
+ "import/no-webpack-loader-syntax": ["error"],
93
+
94
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/consistent-type-specifier-style.md
95
+ // Enforce or ban the use of inline type-only markers for named imports.
96
+ "import/consistent-type-specifier-style": ["warn", "prefer-top-level"],
97
+
98
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/dynamic-import-chunkname.md
99
+ // Enforce a leading comment with the webpackChunkName for dynamic imports.
100
+ "import/dynamic-import-chunkname": ["error"],
101
+
102
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/exports-last.md
103
+ // Ensure all exports appear after other statements.
104
+ // TODO: Can be enabled
105
+ "import/exports-last": ["off"],
106
+
107
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/extensions.md
108
+ // Ensure consistent use of file extension within the import path.
109
+ "import/extensions": ["error", "never"],
110
+
111
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md
112
+ // Ensure all imports appear before other statements.
113
+ "import/first": ["warn"],
114
+
115
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/group-exports.md
116
+ // Prefer named exports to be grouped together in a single export declaration
117
+ // TODO: Can be enabled
118
+ "import/group-exports": ["off"],
119
+
120
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/max-dependencies.md
121
+ // Enforce the maximum number of dependencies a module can have.
122
+ "import/max-dependencies": ["off"],
123
+
124
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/newline-after-import.md
125
+ // Enforce a newline after import statements.
126
+ "import/newline-after-import": ["warn"],
127
+
128
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-anonymous-default-export.md
129
+ // Forbid anonymous values as default exports.
130
+ "import/no-anonymous-default-export": ["error"],
131
+
132
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-default-export.md
133
+ // Forbid default exports.
134
+ "import/no-default-export": ["off"],
135
+
136
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-named-default.md
137
+ // Forbid named default exports.
138
+ "import/no-named-default": ["off"],
139
+
140
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-named-export.md
141
+ // Forbid named exports.
142
+ "import/no-named-export": ["off"],
143
+
144
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-namespace.md
145
+ // Forbid namespace (a.k.a. "wildcard" *) imports.
146
+ "import/no-namespace": ["warn"],
147
+
148
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unassigned-import.md
149
+ // Forbid unassigned imports
150
+ "import/no-unassigned-import": ["error", { allow: ["**/*.css"] }],
151
+
152
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md
153
+ // Enforce a convention in module import order.
154
+ "import/order": ["warn"],
155
+
156
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/prefer-default-export.md
157
+ // Prefer a default export if module exports a single name or multiple names.
158
+ "import/prefer-default-export": ["off"]
159
+ };