@commencis/eslint-config 1.0.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/LICENSE +201 -0
- package/README.md +102 -0
- package/dist/configs/base.d.ts +8 -0
- package/dist/configs/base.js +155 -0
- package/dist/configs/next.d.ts +6 -0
- package/dist/configs/next.js +192 -0
- package/dist/configs/prettier.d.ts +6 -0
- package/dist/configs/prettier.js +9 -0
- package/dist/configs/react.d.ts +6 -0
- package/dist/configs/react.js +191 -0
- package/dist/configs/typescript.d.ts +6 -0
- package/dist/configs/typescript.js +23 -0
- package/dist/configs/vue.d.ts +6 -0
- package/dist/configs/vue.js +190 -0
- package/dist/flatConfig-CFiBdxNB.d.ts +18 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +223 -0
- package/package.json +84 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
// src/configs/base.ts
|
|
2
|
+
import globals from "globals";
|
|
3
|
+
import eslint from "@eslint/js";
|
|
4
|
+
|
|
5
|
+
// src/plugins/importSortPlugin.ts
|
|
6
|
+
import simpleImportSortPlugin from "eslint-plugin-simple-import-sort";
|
|
7
|
+
|
|
8
|
+
// src/rules/importSortRules.ts
|
|
9
|
+
var importSortRules = {
|
|
10
|
+
"simple-import-sort/imports": [
|
|
11
|
+
"error",
|
|
12
|
+
{
|
|
13
|
+
groups: [
|
|
14
|
+
// External package imports
|
|
15
|
+
["^\\w", "^@\\w"],
|
|
16
|
+
// @commencis package imports
|
|
17
|
+
["^@commencis"],
|
|
18
|
+
// Config, util imports
|
|
19
|
+
["(@/config|@/util)"],
|
|
20
|
+
// Type imports
|
|
21
|
+
["@/type"],
|
|
22
|
+
// Absolute imports
|
|
23
|
+
["^@/"],
|
|
24
|
+
// Relative imports
|
|
25
|
+
["^\\.\\./", "^\\./"],
|
|
26
|
+
// Style imports
|
|
27
|
+
["^.+\\.s?css$"]
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"simple-import-sort/exports": "error"
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// src/rules/nextPluginRules.ts
|
|
35
|
+
var nextPluginRules = {
|
|
36
|
+
// Breaks with ESLint 9, should be activated after the next plugin is updated
|
|
37
|
+
"@next/next/no-duplicate-head": "off"
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// src/rules/reactHooksRules.ts
|
|
41
|
+
var reactHooksRules = {
|
|
42
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
43
|
+
"react-hooks/rules-of-hooks": "error"
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// src/rules/reactRules.ts
|
|
47
|
+
var reactRules = {
|
|
48
|
+
// Disable JS specific rules
|
|
49
|
+
"react/jsx-filename-extension": "off",
|
|
50
|
+
"react/default-props-match-prop-types": "off",
|
|
51
|
+
"react/prop-types": "off",
|
|
52
|
+
// Breaks @typescript-eslint/parser
|
|
53
|
+
"react/jsx-indent": "off",
|
|
54
|
+
"react/no-typos": "off",
|
|
55
|
+
"react/jsx-closing-tag-location": "off",
|
|
56
|
+
"react/jsx-wrap-multilines": "off",
|
|
57
|
+
// No longer necessary
|
|
58
|
+
// https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#eslint
|
|
59
|
+
"react/jsx-uses-react": "off",
|
|
60
|
+
"react/react-in-jsx-scope": "off"
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// src/rules/typescriptRules.ts
|
|
64
|
+
var typescriptRules = {
|
|
65
|
+
"@typescript-eslint/consistent-type-definitions": "off",
|
|
66
|
+
"@typescript-eslint/no-empty-function": "off"
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// src/plugins/importSortPlugin.ts
|
|
70
|
+
var importSortPluginConfig = {
|
|
71
|
+
name: "commencis/plugin:simple-import-sort",
|
|
72
|
+
plugins: {
|
|
73
|
+
"simple-import-sort": simpleImportSortPlugin
|
|
74
|
+
},
|
|
75
|
+
rules: {
|
|
76
|
+
...importSortRules
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// src/plugins/nextPlugin.ts
|
|
81
|
+
import nextPlugin from "@next/eslint-plugin-next";
|
|
82
|
+
|
|
83
|
+
// src/constants/index.ts
|
|
84
|
+
var JSX_TSX_FILE_PATTERNS = ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"];
|
|
85
|
+
|
|
86
|
+
// src/plugins/nextPlugin.ts
|
|
87
|
+
var nextPluginConfig = {
|
|
88
|
+
name: "commencis/plugin:next",
|
|
89
|
+
files: JSX_TSX_FILE_PATTERNS,
|
|
90
|
+
plugins: {
|
|
91
|
+
"@next/next": nextPlugin
|
|
92
|
+
},
|
|
93
|
+
rules: {
|
|
94
|
+
...nextPlugin.configs.recommended.rules,
|
|
95
|
+
...nextPlugin.configs["core-web-vitals"].rules,
|
|
96
|
+
...nextPluginRules
|
|
97
|
+
},
|
|
98
|
+
ignores: [".next/*"]
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// src/plugins/reactHooksPlugin.ts
|
|
102
|
+
import reactHooksPlugin from "eslint-plugin-react-hooks";
|
|
103
|
+
var reactHooksPluginConfig = {
|
|
104
|
+
name: "commencis/plugin:react-hooks",
|
|
105
|
+
files: JSX_TSX_FILE_PATTERNS,
|
|
106
|
+
plugins: {
|
|
107
|
+
"react-hooks": reactHooksPlugin
|
|
108
|
+
},
|
|
109
|
+
rules: { ...reactHooksRules }
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// src/plugins/reactPlugin.ts
|
|
113
|
+
import reactPlugin from "eslint-plugin-react";
|
|
114
|
+
var reactPluginConfig = {
|
|
115
|
+
name: "commencis/plugin:react",
|
|
116
|
+
files: JSX_TSX_FILE_PATTERNS,
|
|
117
|
+
languageOptions: { ...reactPlugin.configs.recommended.languageOptions },
|
|
118
|
+
plugins: {
|
|
119
|
+
react: reactPlugin
|
|
120
|
+
},
|
|
121
|
+
rules: {
|
|
122
|
+
...reactPlugin.configs.recommended.rules,
|
|
123
|
+
...reactRules
|
|
124
|
+
},
|
|
125
|
+
settings: {
|
|
126
|
+
react: {
|
|
127
|
+
version: "detect"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// src/plugins/vuePlugin.ts
|
|
133
|
+
import vuePlugin from "eslint-plugin-vue";
|
|
134
|
+
var vuePluginConfig = {
|
|
135
|
+
...vuePlugin.configs.recommended,
|
|
136
|
+
name: "commencis/plugin:vue"
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// src/configs/base.ts
|
|
140
|
+
var base_default = [
|
|
141
|
+
eslint.configs.recommended,
|
|
142
|
+
importSortPluginConfig,
|
|
143
|
+
{
|
|
144
|
+
name: "commencis/base",
|
|
145
|
+
languageOptions: {
|
|
146
|
+
ecmaVersion: 2022,
|
|
147
|
+
globals: {
|
|
148
|
+
...globals.browser,
|
|
149
|
+
...globals.es2021,
|
|
150
|
+
...globals.node,
|
|
151
|
+
...globals.serviceworker
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
rules: {
|
|
155
|
+
"no-console": "warn"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
];
|
|
159
|
+
|
|
160
|
+
// src/configs/prettier.ts
|
|
161
|
+
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
|
162
|
+
var prettier_default = [
|
|
163
|
+
eslintPluginPrettierRecommended,
|
|
164
|
+
{ name: "commencis/prettier" }
|
|
165
|
+
];
|
|
166
|
+
|
|
167
|
+
// src/configs/typescript.ts
|
|
168
|
+
import tseslint from "typescript-eslint";
|
|
169
|
+
var typescript_default = [
|
|
170
|
+
...tseslint.configs.strict,
|
|
171
|
+
...tseslint.configs.stylistic,
|
|
172
|
+
{
|
|
173
|
+
name: "commencis/typescript",
|
|
174
|
+
rules: {
|
|
175
|
+
...typescriptRules
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
];
|
|
179
|
+
|
|
180
|
+
// src/configs/react.ts
|
|
181
|
+
var react_default = [
|
|
182
|
+
...base_default,
|
|
183
|
+
...typescript_default,
|
|
184
|
+
reactPluginConfig,
|
|
185
|
+
reactHooksPluginConfig,
|
|
186
|
+
...prettier_default,
|
|
187
|
+
{ name: "commencis/react" }
|
|
188
|
+
];
|
|
189
|
+
export {
|
|
190
|
+
react_default as default
|
|
191
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// src/configs/typescript.ts
|
|
2
|
+
import tseslint from "typescript-eslint";
|
|
3
|
+
|
|
4
|
+
// src/rules/typescriptRules.ts
|
|
5
|
+
var typescriptRules = {
|
|
6
|
+
"@typescript-eslint/consistent-type-definitions": "off",
|
|
7
|
+
"@typescript-eslint/no-empty-function": "off"
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// src/configs/typescript.ts
|
|
11
|
+
var typescript_default = [
|
|
12
|
+
...tseslint.configs.strict,
|
|
13
|
+
...tseslint.configs.stylistic,
|
|
14
|
+
{
|
|
15
|
+
name: "commencis/typescript",
|
|
16
|
+
rules: {
|
|
17
|
+
...typescriptRules
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
];
|
|
21
|
+
export {
|
|
22
|
+
typescript_default as default
|
|
23
|
+
};
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
// src/configs/base.ts
|
|
2
|
+
import globals from "globals";
|
|
3
|
+
import eslint from "@eslint/js";
|
|
4
|
+
|
|
5
|
+
// src/plugins/importSortPlugin.ts
|
|
6
|
+
import simpleImportSortPlugin from "eslint-plugin-simple-import-sort";
|
|
7
|
+
|
|
8
|
+
// src/rules/importSortRules.ts
|
|
9
|
+
var importSortRules = {
|
|
10
|
+
"simple-import-sort/imports": [
|
|
11
|
+
"error",
|
|
12
|
+
{
|
|
13
|
+
groups: [
|
|
14
|
+
// External package imports
|
|
15
|
+
["^\\w", "^@\\w"],
|
|
16
|
+
// @commencis package imports
|
|
17
|
+
["^@commencis"],
|
|
18
|
+
// Config, util imports
|
|
19
|
+
["(@/config|@/util)"],
|
|
20
|
+
// Type imports
|
|
21
|
+
["@/type"],
|
|
22
|
+
// Absolute imports
|
|
23
|
+
["^@/"],
|
|
24
|
+
// Relative imports
|
|
25
|
+
["^\\.\\./", "^\\./"],
|
|
26
|
+
// Style imports
|
|
27
|
+
["^.+\\.s?css$"]
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"simple-import-sort/exports": "error"
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// src/rules/nextPluginRules.ts
|
|
35
|
+
var nextPluginRules = {
|
|
36
|
+
// Breaks with ESLint 9, should be activated after the next plugin is updated
|
|
37
|
+
"@next/next/no-duplicate-head": "off"
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// src/rules/reactHooksRules.ts
|
|
41
|
+
var reactHooksRules = {
|
|
42
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
43
|
+
"react-hooks/rules-of-hooks": "error"
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// src/rules/reactRules.ts
|
|
47
|
+
var reactRules = {
|
|
48
|
+
// Disable JS specific rules
|
|
49
|
+
"react/jsx-filename-extension": "off",
|
|
50
|
+
"react/default-props-match-prop-types": "off",
|
|
51
|
+
"react/prop-types": "off",
|
|
52
|
+
// Breaks @typescript-eslint/parser
|
|
53
|
+
"react/jsx-indent": "off",
|
|
54
|
+
"react/no-typos": "off",
|
|
55
|
+
"react/jsx-closing-tag-location": "off",
|
|
56
|
+
"react/jsx-wrap-multilines": "off",
|
|
57
|
+
// No longer necessary
|
|
58
|
+
// https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#eslint
|
|
59
|
+
"react/jsx-uses-react": "off",
|
|
60
|
+
"react/react-in-jsx-scope": "off"
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// src/rules/typescriptRules.ts
|
|
64
|
+
var typescriptRules = {
|
|
65
|
+
"@typescript-eslint/consistent-type-definitions": "off",
|
|
66
|
+
"@typescript-eslint/no-empty-function": "off"
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// src/plugins/importSortPlugin.ts
|
|
70
|
+
var importSortPluginConfig = {
|
|
71
|
+
name: "commencis/plugin:simple-import-sort",
|
|
72
|
+
plugins: {
|
|
73
|
+
"simple-import-sort": simpleImportSortPlugin
|
|
74
|
+
},
|
|
75
|
+
rules: {
|
|
76
|
+
...importSortRules
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// src/plugins/nextPlugin.ts
|
|
81
|
+
import nextPlugin from "@next/eslint-plugin-next";
|
|
82
|
+
|
|
83
|
+
// src/constants/index.ts
|
|
84
|
+
var JSX_TSX_FILE_PATTERNS = ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"];
|
|
85
|
+
|
|
86
|
+
// src/plugins/nextPlugin.ts
|
|
87
|
+
var nextPluginConfig = {
|
|
88
|
+
name: "commencis/plugin:next",
|
|
89
|
+
files: JSX_TSX_FILE_PATTERNS,
|
|
90
|
+
plugins: {
|
|
91
|
+
"@next/next": nextPlugin
|
|
92
|
+
},
|
|
93
|
+
rules: {
|
|
94
|
+
...nextPlugin.configs.recommended.rules,
|
|
95
|
+
...nextPlugin.configs["core-web-vitals"].rules,
|
|
96
|
+
...nextPluginRules
|
|
97
|
+
},
|
|
98
|
+
ignores: [".next/*"]
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// src/plugins/reactHooksPlugin.ts
|
|
102
|
+
import reactHooksPlugin from "eslint-plugin-react-hooks";
|
|
103
|
+
var reactHooksPluginConfig = {
|
|
104
|
+
name: "commencis/plugin:react-hooks",
|
|
105
|
+
files: JSX_TSX_FILE_PATTERNS,
|
|
106
|
+
plugins: {
|
|
107
|
+
"react-hooks": reactHooksPlugin
|
|
108
|
+
},
|
|
109
|
+
rules: { ...reactHooksRules }
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// src/plugins/reactPlugin.ts
|
|
113
|
+
import reactPlugin from "eslint-plugin-react";
|
|
114
|
+
var reactPluginConfig = {
|
|
115
|
+
name: "commencis/plugin:react",
|
|
116
|
+
files: JSX_TSX_FILE_PATTERNS,
|
|
117
|
+
languageOptions: { ...reactPlugin.configs.recommended.languageOptions },
|
|
118
|
+
plugins: {
|
|
119
|
+
react: reactPlugin
|
|
120
|
+
},
|
|
121
|
+
rules: {
|
|
122
|
+
...reactPlugin.configs.recommended.rules,
|
|
123
|
+
...reactRules
|
|
124
|
+
},
|
|
125
|
+
settings: {
|
|
126
|
+
react: {
|
|
127
|
+
version: "detect"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// src/plugins/vuePlugin.ts
|
|
133
|
+
import vuePlugin from "eslint-plugin-vue";
|
|
134
|
+
var vuePluginConfig = {
|
|
135
|
+
...vuePlugin.configs.recommended,
|
|
136
|
+
name: "commencis/plugin:vue"
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// src/configs/base.ts
|
|
140
|
+
var base_default = [
|
|
141
|
+
eslint.configs.recommended,
|
|
142
|
+
importSortPluginConfig,
|
|
143
|
+
{
|
|
144
|
+
name: "commencis/base",
|
|
145
|
+
languageOptions: {
|
|
146
|
+
ecmaVersion: 2022,
|
|
147
|
+
globals: {
|
|
148
|
+
...globals.browser,
|
|
149
|
+
...globals.es2021,
|
|
150
|
+
...globals.node,
|
|
151
|
+
...globals.serviceworker
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
rules: {
|
|
155
|
+
"no-console": "warn"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
];
|
|
159
|
+
|
|
160
|
+
// src/configs/prettier.ts
|
|
161
|
+
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
|
162
|
+
var prettier_default = [
|
|
163
|
+
eslintPluginPrettierRecommended,
|
|
164
|
+
{ name: "commencis/prettier" }
|
|
165
|
+
];
|
|
166
|
+
|
|
167
|
+
// src/configs/typescript.ts
|
|
168
|
+
import tseslint from "typescript-eslint";
|
|
169
|
+
var typescript_default = [
|
|
170
|
+
...tseslint.configs.strict,
|
|
171
|
+
...tseslint.configs.stylistic,
|
|
172
|
+
{
|
|
173
|
+
name: "commencis/typescript",
|
|
174
|
+
rules: {
|
|
175
|
+
...typescriptRules
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
];
|
|
179
|
+
|
|
180
|
+
// src/configs/vue.ts
|
|
181
|
+
var vue_default = [
|
|
182
|
+
...base_default,
|
|
183
|
+
...typescript_default,
|
|
184
|
+
vuePluginConfig,
|
|
185
|
+
...prettier_default,
|
|
186
|
+
{ name: "commencis/vue" }
|
|
187
|
+
];
|
|
188
|
+
export {
|
|
189
|
+
vue_default as default
|
|
190
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Linter } from 'eslint';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Relax plugins type limitation,
|
|
5
|
+
* as most of the plugins did not have correct type info yet.
|
|
6
|
+
*
|
|
7
|
+
* An object containing a name-value mapping of plugin names to plugin objects.
|
|
8
|
+
* When `files` is specified, these plugins are only available to the matching files.
|
|
9
|
+
*
|
|
10
|
+
* @see Using plugins in your configuration]
|
|
11
|
+
* (https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
|
|
12
|
+
*/
|
|
13
|
+
type FlatConfig = Omit<Linter.FlatConfig<Linter.RulesRecord>, 'plugins'> & {
|
|
14
|
+
plugins?: Record<string, unknown>;
|
|
15
|
+
};
|
|
16
|
+
type FlatConfigArray = FlatConfig[];
|
|
17
|
+
|
|
18
|
+
export type { FlatConfig as F, FlatConfigArray as a };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as typescript_eslint from 'typescript-eslint';
|
|
2
|
+
export { default as commencisBaseConfig } from './configs/base.js';
|
|
3
|
+
export { default as commencisNextConfig } from './configs/next.js';
|
|
4
|
+
export { default as commencisPrettierConfig } from './configs/prettier.js';
|
|
5
|
+
export { default as commencisReactConfig } from './configs/react.js';
|
|
6
|
+
export { default as commencisTypescriptConfig } from './configs/typescript.js';
|
|
7
|
+
export { default as commencisVueConfig } from './configs/vue.js';
|
|
8
|
+
import 'eslint';
|
|
9
|
+
import './flatConfig-CFiBdxNB.js';
|
|
10
|
+
|
|
11
|
+
declare const defineConfig: typeof typescript_eslint.config;
|
|
12
|
+
|
|
13
|
+
export { defineConfig };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import tseslint2 from "typescript-eslint";
|
|
3
|
+
|
|
4
|
+
// src/configs/base.ts
|
|
5
|
+
import globals from "globals";
|
|
6
|
+
import eslint from "@eslint/js";
|
|
7
|
+
|
|
8
|
+
// src/plugins/importSortPlugin.ts
|
|
9
|
+
import simpleImportSortPlugin from "eslint-plugin-simple-import-sort";
|
|
10
|
+
|
|
11
|
+
// src/rules/importSortRules.ts
|
|
12
|
+
var importSortRules = {
|
|
13
|
+
"simple-import-sort/imports": [
|
|
14
|
+
"error",
|
|
15
|
+
{
|
|
16
|
+
groups: [
|
|
17
|
+
// External package imports
|
|
18
|
+
["^\\w", "^@\\w"],
|
|
19
|
+
// @commencis package imports
|
|
20
|
+
["^@commencis"],
|
|
21
|
+
// Config, util imports
|
|
22
|
+
["(@/config|@/util)"],
|
|
23
|
+
// Type imports
|
|
24
|
+
["@/type"],
|
|
25
|
+
// Absolute imports
|
|
26
|
+
["^@/"],
|
|
27
|
+
// Relative imports
|
|
28
|
+
["^\\.\\./", "^\\./"],
|
|
29
|
+
// Style imports
|
|
30
|
+
["^.+\\.s?css$"]
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"simple-import-sort/exports": "error"
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// src/rules/nextPluginRules.ts
|
|
38
|
+
var nextPluginRules = {
|
|
39
|
+
// Breaks with ESLint 9, should be activated after the next plugin is updated
|
|
40
|
+
"@next/next/no-duplicate-head": "off"
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// src/rules/reactHooksRules.ts
|
|
44
|
+
var reactHooksRules = {
|
|
45
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
46
|
+
"react-hooks/rules-of-hooks": "error"
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// src/rules/reactRules.ts
|
|
50
|
+
var reactRules = {
|
|
51
|
+
// Disable JS specific rules
|
|
52
|
+
"react/jsx-filename-extension": "off",
|
|
53
|
+
"react/default-props-match-prop-types": "off",
|
|
54
|
+
"react/prop-types": "off",
|
|
55
|
+
// Breaks @typescript-eslint/parser
|
|
56
|
+
"react/jsx-indent": "off",
|
|
57
|
+
"react/no-typos": "off",
|
|
58
|
+
"react/jsx-closing-tag-location": "off",
|
|
59
|
+
"react/jsx-wrap-multilines": "off",
|
|
60
|
+
// No longer necessary
|
|
61
|
+
// https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#eslint
|
|
62
|
+
"react/jsx-uses-react": "off",
|
|
63
|
+
"react/react-in-jsx-scope": "off"
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// src/rules/typescriptRules.ts
|
|
67
|
+
var typescriptRules = {
|
|
68
|
+
"@typescript-eslint/consistent-type-definitions": "off",
|
|
69
|
+
"@typescript-eslint/no-empty-function": "off"
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// src/plugins/importSortPlugin.ts
|
|
73
|
+
var importSortPluginConfig = {
|
|
74
|
+
name: "commencis/plugin:simple-import-sort",
|
|
75
|
+
plugins: {
|
|
76
|
+
"simple-import-sort": simpleImportSortPlugin
|
|
77
|
+
},
|
|
78
|
+
rules: {
|
|
79
|
+
...importSortRules
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// src/plugins/nextPlugin.ts
|
|
84
|
+
import nextPlugin from "@next/eslint-plugin-next";
|
|
85
|
+
|
|
86
|
+
// src/constants/index.ts
|
|
87
|
+
var JSX_TSX_FILE_PATTERNS = ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"];
|
|
88
|
+
|
|
89
|
+
// src/plugins/nextPlugin.ts
|
|
90
|
+
var nextPluginConfig = {
|
|
91
|
+
name: "commencis/plugin:next",
|
|
92
|
+
files: JSX_TSX_FILE_PATTERNS,
|
|
93
|
+
plugins: {
|
|
94
|
+
"@next/next": nextPlugin
|
|
95
|
+
},
|
|
96
|
+
rules: {
|
|
97
|
+
...nextPlugin.configs.recommended.rules,
|
|
98
|
+
...nextPlugin.configs["core-web-vitals"].rules,
|
|
99
|
+
...nextPluginRules
|
|
100
|
+
},
|
|
101
|
+
ignores: [".next/*"]
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// src/plugins/reactHooksPlugin.ts
|
|
105
|
+
import reactHooksPlugin from "eslint-plugin-react-hooks";
|
|
106
|
+
var reactHooksPluginConfig = {
|
|
107
|
+
name: "commencis/plugin:react-hooks",
|
|
108
|
+
files: JSX_TSX_FILE_PATTERNS,
|
|
109
|
+
plugins: {
|
|
110
|
+
"react-hooks": reactHooksPlugin
|
|
111
|
+
},
|
|
112
|
+
rules: { ...reactHooksRules }
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// src/plugins/reactPlugin.ts
|
|
116
|
+
import reactPlugin from "eslint-plugin-react";
|
|
117
|
+
var reactPluginConfig = {
|
|
118
|
+
name: "commencis/plugin:react",
|
|
119
|
+
files: JSX_TSX_FILE_PATTERNS,
|
|
120
|
+
languageOptions: { ...reactPlugin.configs.recommended.languageOptions },
|
|
121
|
+
plugins: {
|
|
122
|
+
react: reactPlugin
|
|
123
|
+
},
|
|
124
|
+
rules: {
|
|
125
|
+
...reactPlugin.configs.recommended.rules,
|
|
126
|
+
...reactRules
|
|
127
|
+
},
|
|
128
|
+
settings: {
|
|
129
|
+
react: {
|
|
130
|
+
version: "detect"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// src/plugins/vuePlugin.ts
|
|
136
|
+
import vuePlugin from "eslint-plugin-vue";
|
|
137
|
+
var vuePluginConfig = {
|
|
138
|
+
...vuePlugin.configs.recommended,
|
|
139
|
+
name: "commencis/plugin:vue"
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// src/configs/base.ts
|
|
143
|
+
var base_default = [
|
|
144
|
+
eslint.configs.recommended,
|
|
145
|
+
importSortPluginConfig,
|
|
146
|
+
{
|
|
147
|
+
name: "commencis/base",
|
|
148
|
+
languageOptions: {
|
|
149
|
+
ecmaVersion: 2022,
|
|
150
|
+
globals: {
|
|
151
|
+
...globals.browser,
|
|
152
|
+
...globals.es2021,
|
|
153
|
+
...globals.node,
|
|
154
|
+
...globals.serviceworker
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
rules: {
|
|
158
|
+
"no-console": "warn"
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
];
|
|
162
|
+
|
|
163
|
+
// src/configs/prettier.ts
|
|
164
|
+
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
|
|
165
|
+
var prettier_default = [
|
|
166
|
+
eslintPluginPrettierRecommended,
|
|
167
|
+
{ name: "commencis/prettier" }
|
|
168
|
+
];
|
|
169
|
+
|
|
170
|
+
// src/configs/typescript.ts
|
|
171
|
+
import tseslint from "typescript-eslint";
|
|
172
|
+
var typescript_default = [
|
|
173
|
+
...tseslint.configs.strict,
|
|
174
|
+
...tseslint.configs.stylistic,
|
|
175
|
+
{
|
|
176
|
+
name: "commencis/typescript",
|
|
177
|
+
rules: {
|
|
178
|
+
...typescriptRules
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
];
|
|
182
|
+
|
|
183
|
+
// src/configs/next.ts
|
|
184
|
+
var next_default = [
|
|
185
|
+
...base_default,
|
|
186
|
+
...typescript_default,
|
|
187
|
+
reactPluginConfig,
|
|
188
|
+
reactHooksPluginConfig,
|
|
189
|
+
nextPluginConfig,
|
|
190
|
+
...prettier_default,
|
|
191
|
+
{ name: "commencis/next" }
|
|
192
|
+
];
|
|
193
|
+
|
|
194
|
+
// src/configs/react.ts
|
|
195
|
+
var react_default = [
|
|
196
|
+
...base_default,
|
|
197
|
+
...typescript_default,
|
|
198
|
+
reactPluginConfig,
|
|
199
|
+
reactHooksPluginConfig,
|
|
200
|
+
...prettier_default,
|
|
201
|
+
{ name: "commencis/react" }
|
|
202
|
+
];
|
|
203
|
+
|
|
204
|
+
// src/configs/vue.ts
|
|
205
|
+
var vue_default = [
|
|
206
|
+
...base_default,
|
|
207
|
+
...typescript_default,
|
|
208
|
+
vuePluginConfig,
|
|
209
|
+
...prettier_default,
|
|
210
|
+
{ name: "commencis/vue" }
|
|
211
|
+
];
|
|
212
|
+
|
|
213
|
+
// src/index.ts
|
|
214
|
+
var defineConfig = tseslint2.config;
|
|
215
|
+
export {
|
|
216
|
+
base_default as commencisBaseConfig,
|
|
217
|
+
next_default as commencisNextConfig,
|
|
218
|
+
prettier_default as commencisPrettierConfig,
|
|
219
|
+
react_default as commencisReactConfig,
|
|
220
|
+
typescript_default as commencisTypescriptConfig,
|
|
221
|
+
vue_default as commencisVueConfig,
|
|
222
|
+
defineConfig
|
|
223
|
+
};
|