@commencis/eslint-config 2.4.0 → 3.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.
@@ -1,135 +0,0 @@
1
- // src/configs/typescript.ts
2
- import tseslint from "typescript-eslint";
3
-
4
- // src/rules/importSortRules.ts
5
- function asTypeOnly(pattern) {
6
- const base = pattern.endsWith("$") ? pattern.slice(0, -1) : pattern;
7
- return `${base}\\u0000$`;
8
- }
9
- function withTypeFirst(group) {
10
- return group.flatMap((pattern) => [asTypeOnly(pattern), pattern]);
11
- }
12
- function exact(p) {
13
- return `^@/${p}$`;
14
- }
15
- function subpath(p) {
16
- return `^@/${p}/.+$`;
17
- }
18
- function expandFolders(folders) {
19
- return folders.flatMap((name) => [exact(name), subpath(name)]);
20
- }
21
- var GROUPS = {
22
- // Side effects (simple-import-sort prefixes side-effects with \u0000 at the start)
23
- SIDE_EFFECTS: ["^\\u0000"],
24
- // Main frameworks & libraries
25
- FRAMEWORKS: [
26
- "^(react(-native|-dom)?(/.*)?)$",
27
- "^next",
28
- "^vue",
29
- "^nuxt",
30
- "^@angular(/.*|$)",
31
- "^expo",
32
- "^node"
33
- ],
34
- // External packages
35
- EXTERNAL: ["^@commencis", "^@?\\w"],
36
- // Internal common directories
37
- INTERNAL_COMMON: expandFolders([
38
- "config",
39
- "types",
40
- "interfaces",
41
- "constants",
42
- "helpers",
43
- "utils",
44
- "lib"
45
- ]),
46
- // Component directories
47
- COMPONENTS: expandFolders([
48
- "providers",
49
- "layouts",
50
- "pages",
51
- "modules",
52
- "features",
53
- "components"
54
- ]),
55
- // Internal root alias (catch-all leftover @/ imports except styles and assets)
56
- INTERNAL_ROOT: ["^@/(?!.*\\.(s?css|svg|png)$).+$"],
57
- // Relative parent imports then same-dir relatives
58
- RELATIVE_PARENT: ["^\\.\\.(?!/?$)", "^\\.\\./?$"],
59
- RELATIVE_SAME: ["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
60
- // Assets
61
- ASSETS: [
62
- "(asset(s?)|public|static|images)(/.*|$)",
63
- "^@/.+\\.(svg|png)$",
64
- "^.+\\.svg$",
65
- "^.+\\.png$"
66
- ],
67
- // Styles
68
- STYLES: [
69
- // side-effect - virtual css imports
70
- "^\\u0000.+\\.s?css$",
71
- // root alias css imports
72
- "^@/.+\\.s?css$",
73
- // relative css imports
74
- "^(\\.{1,2}/).+\\.s?css$"
75
- ]
76
- };
77
- var importSortRules = {
78
- "simple-import-sort/imports": [
79
- "error",
80
- {
81
- groups: [
82
- GROUPS.SIDE_EFFECTS,
83
- withTypeFirst(GROUPS.FRAMEWORKS),
84
- withTypeFirst(GROUPS.EXTERNAL),
85
- withTypeFirst(GROUPS.INTERNAL_COMMON),
86
- withTypeFirst(GROUPS.COMPONENTS),
87
- withTypeFirst(GROUPS.INTERNAL_ROOT),
88
- withTypeFirst(GROUPS.RELATIVE_PARENT),
89
- withTypeFirst(GROUPS.RELATIVE_SAME),
90
- GROUPS.ASSETS,
91
- GROUPS.STYLES
92
- ]
93
- }
94
- ],
95
- "simple-import-sort/exports": "error"
96
- };
97
-
98
- // src/rules/typescriptRules.ts
99
- var typescriptRules = {
100
- "@typescript-eslint/consistent-type-definitions": "off",
101
- "@typescript-eslint/no-empty-function": "off",
102
- "@typescript-eslint/array-type": "off",
103
- "@typescript-eslint/explicit-function-return-type": "error",
104
- "@typescript-eslint/consistent-type-imports": [
105
- "error",
106
- {
107
- prefer: "type-imports",
108
- fixStyle: "separate-type-imports"
109
- }
110
- ],
111
- "@typescript-eslint/no-unused-vars": [
112
- "error",
113
- {
114
- argsIgnorePattern: "^_",
115
- caughtErrorsIgnorePattern: "^_",
116
- destructuredArrayIgnorePattern: "^_",
117
- varsIgnorePattern: "^_"
118
- }
119
- ]
120
- };
121
-
122
- // src/configs/typescript.ts
123
- var typescript_default = [
124
- ...tseslint.configs.strict,
125
- ...tseslint.configs.stylistic,
126
- {
127
- name: "commencis/typescript",
128
- rules: {
129
- ...typescriptRules
130
- }
131
- }
132
- ];
133
- export {
134
- typescript_default as default
135
- };
@@ -1,6 +0,0 @@
1
- import { a as FlatConfigArray } from '../flatConfig-Cm6wkwA_.js';
2
- import 'eslint';
3
-
4
- declare const _default: FlatConfigArray;
5
-
6
- export { _default as default };
@@ -1,313 +0,0 @@
1
- // src/configs/vue.ts
2
- import tseslint2 from "typescript-eslint";
3
-
4
- // src/configs/base.ts
5
- import eslint from "@eslint/js";
6
- import globals from "globals";
7
-
8
- // src/plugins/importSortPlugin.ts
9
- import simpleImportSortPlugin from "eslint-plugin-simple-import-sort";
10
-
11
- // src/rules/importSortRules.ts
12
- function asTypeOnly(pattern) {
13
- const base = pattern.endsWith("$") ? pattern.slice(0, -1) : pattern;
14
- return `${base}\\u0000$`;
15
- }
16
- function withTypeFirst(group) {
17
- return group.flatMap((pattern) => [asTypeOnly(pattern), pattern]);
18
- }
19
- function exact(p) {
20
- return `^@/${p}$`;
21
- }
22
- function subpath(p) {
23
- return `^@/${p}/.+$`;
24
- }
25
- function expandFolders(folders) {
26
- return folders.flatMap((name) => [exact(name), subpath(name)]);
27
- }
28
- var GROUPS = {
29
- // Side effects (simple-import-sort prefixes side-effects with \u0000 at the start)
30
- SIDE_EFFECTS: ["^\\u0000"],
31
- // Main frameworks & libraries
32
- FRAMEWORKS: [
33
- "^(react(-native|-dom)?(/.*)?)$",
34
- "^next",
35
- "^vue",
36
- "^nuxt",
37
- "^@angular(/.*|$)",
38
- "^expo",
39
- "^node"
40
- ],
41
- // External packages
42
- EXTERNAL: ["^@commencis", "^@?\\w"],
43
- // Internal common directories
44
- INTERNAL_COMMON: expandFolders([
45
- "config",
46
- "types",
47
- "interfaces",
48
- "constants",
49
- "helpers",
50
- "utils",
51
- "lib"
52
- ]),
53
- // Component directories
54
- COMPONENTS: expandFolders([
55
- "providers",
56
- "layouts",
57
- "pages",
58
- "modules",
59
- "features",
60
- "components"
61
- ]),
62
- // Internal root alias (catch-all leftover @/ imports except styles and assets)
63
- INTERNAL_ROOT: ["^@/(?!.*\\.(s?css|svg|png)$).+$"],
64
- // Relative parent imports then same-dir relatives
65
- RELATIVE_PARENT: ["^\\.\\.(?!/?$)", "^\\.\\./?$"],
66
- RELATIVE_SAME: ["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
67
- // Assets
68
- ASSETS: [
69
- "(asset(s?)|public|static|images)(/.*|$)",
70
- "^@/.+\\.(svg|png)$",
71
- "^.+\\.svg$",
72
- "^.+\\.png$"
73
- ],
74
- // Styles
75
- STYLES: [
76
- // side-effect - virtual css imports
77
- "^\\u0000.+\\.s?css$",
78
- // root alias css imports
79
- "^@/.+\\.s?css$",
80
- // relative css imports
81
- "^(\\.{1,2}/).+\\.s?css$"
82
- ]
83
- };
84
- var importSortRules = {
85
- "simple-import-sort/imports": [
86
- "error",
87
- {
88
- groups: [
89
- GROUPS.SIDE_EFFECTS,
90
- withTypeFirst(GROUPS.FRAMEWORKS),
91
- withTypeFirst(GROUPS.EXTERNAL),
92
- withTypeFirst(GROUPS.INTERNAL_COMMON),
93
- withTypeFirst(GROUPS.COMPONENTS),
94
- withTypeFirst(GROUPS.INTERNAL_ROOT),
95
- withTypeFirst(GROUPS.RELATIVE_PARENT),
96
- withTypeFirst(GROUPS.RELATIVE_SAME),
97
- GROUPS.ASSETS,
98
- GROUPS.STYLES
99
- ]
100
- }
101
- ],
102
- "simple-import-sort/exports": "error"
103
- };
104
-
105
- // src/rules/nextPluginRules.ts
106
- var nextPluginRules = {
107
- // Breaks with ESLint 9, should be activated after the next plugin is updated
108
- "@next/next/no-duplicate-head": "off"
109
- };
110
-
111
- // src/rules/reactHooksRules.ts
112
- var reactHooksRules = {
113
- "react-hooks/exhaustive-deps": "warn",
114
- "react-hooks/rules-of-hooks": "error"
115
- };
116
-
117
- // src/rules/reactRules.ts
118
- var reactRules = {
119
- // Disable JS specific rules
120
- "react/jsx-filename-extension": "off",
121
- "react/default-props-match-prop-types": "off",
122
- "react/prop-types": "off",
123
- // Breaks @typescript-eslint/parser
124
- "react/jsx-indent": "off",
125
- "react/no-typos": "off",
126
- "react/jsx-closing-tag-location": "off",
127
- "react/jsx-wrap-multilines": "off",
128
- // No longer necessary
129
- // https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#eslint
130
- "react/jsx-uses-react": "off",
131
- "react/react-in-jsx-scope": "off",
132
- // We are not planning to utilize rules below
133
- "react/jsx-props-no-spreading": "off"
134
- };
135
-
136
- // src/rules/typescriptRules.ts
137
- var typescriptRules = {
138
- "@typescript-eslint/consistent-type-definitions": "off",
139
- "@typescript-eslint/no-empty-function": "off",
140
- "@typescript-eslint/array-type": "off",
141
- "@typescript-eslint/explicit-function-return-type": "error",
142
- "@typescript-eslint/consistent-type-imports": [
143
- "error",
144
- {
145
- prefer: "type-imports",
146
- fixStyle: "separate-type-imports"
147
- }
148
- ],
149
- "@typescript-eslint/no-unused-vars": [
150
- "error",
151
- {
152
- argsIgnorePattern: "^_",
153
- caughtErrorsIgnorePattern: "^_",
154
- destructuredArrayIgnorePattern: "^_",
155
- varsIgnorePattern: "^_"
156
- }
157
- ]
158
- };
159
-
160
- // src/plugins/importSortPlugin.ts
161
- var importSortPluginConfig = {
162
- name: "commencis/plugin:simple-import-sort",
163
- plugins: {
164
- "simple-import-sort": simpleImportSortPlugin
165
- },
166
- rules: {
167
- ...importSortRules
168
- }
169
- };
170
-
171
- // src/plugins/jsxA11yPlugin.ts
172
- import jsxA11yPlugin from "eslint-plugin-jsx-a11y";
173
-
174
- // src/constants/index.ts
175
- var JSX_TSX_FILE_PATTERNS = ["**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}"];
176
-
177
- // src/plugins/jsxA11yPlugin.ts
178
- var jsxA11yPluginConfig = {
179
- name: "commencis/plugin:jsx-a11y",
180
- files: JSX_TSX_FILE_PATTERNS,
181
- plugins: {
182
- "jsx-a11y": jsxA11yPlugin
183
- },
184
- languageOptions: { ...jsxA11yPlugin.flatConfigs.recommended.languageOptions },
185
- rules: {
186
- ...jsxA11yPlugin.flatConfigs.recommended.rules
187
- }
188
- };
189
-
190
- // src/plugins/nextPlugin.ts
191
- import nextPlugin from "@next/eslint-plugin-next";
192
- var nextPluginConfig = {
193
- name: "commencis/plugin:next",
194
- files: JSX_TSX_FILE_PATTERNS,
195
- plugins: {
196
- "@next/next": nextPlugin
197
- },
198
- rules: {
199
- ...nextPlugin.configs.recommended.rules,
200
- ...nextPlugin.configs["core-web-vitals"].rules,
201
- ...nextPluginRules
202
- },
203
- ignores: [".next/*"]
204
- };
205
-
206
- // src/plugins/reactHooksPlugin.ts
207
- import reactHooksPlugin from "eslint-plugin-react-hooks";
208
- var reactHooksPluginConfig = {
209
- name: "commencis/plugin:react-hooks",
210
- files: JSX_TSX_FILE_PATTERNS,
211
- plugins: {
212
- "react-hooks": reactHooksPlugin
213
- },
214
- rules: { ...reactHooksRules }
215
- };
216
-
217
- // src/plugins/reactPlugin.ts
218
- import reactPlugin from "eslint-plugin-react";
219
- var { recommended: recommendedConfig, "jsx-runtime": jsxRuntimeConfig } = reactPlugin.configs.flat;
220
- var reactPluginConfig = {
221
- name: "commencis/plugin:react",
222
- files: JSX_TSX_FILE_PATTERNS,
223
- languageOptions: {
224
- ...recommendedConfig.languageOptions
225
- },
226
- plugins: {
227
- react: reactPlugin
228
- },
229
- rules: {
230
- ...recommendedConfig.rules,
231
- ...jsxRuntimeConfig.rules,
232
- ...reactRules
233
- },
234
- settings: {
235
- react: {
236
- version: "detect"
237
- }
238
- }
239
- };
240
-
241
- // src/plugins/vuePlugin.ts
242
- import vuePlugin from "eslint-plugin-vue";
243
- var vuePluginConfig = [
244
- ...vuePlugin.configs["flat/recommended"],
245
- {
246
- name: "commencis/plugin:vue"
247
- }
248
- ];
249
-
250
- // src/configs/base.ts
251
- var base_default = [
252
- eslint.configs.recommended,
253
- importSortPluginConfig,
254
- {
255
- name: "commencis/base",
256
- languageOptions: {
257
- ecmaVersion: 2022,
258
- globals: {
259
- ...globals.browser,
260
- ...globals.es2021,
261
- ...globals.node,
262
- ...globals.serviceworker
263
- }
264
- },
265
- rules: {
266
- "no-console": "warn"
267
- }
268
- }
269
- ];
270
-
271
- // src/configs/prettier.ts
272
- import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
273
- var prettier_default = [
274
- eslintPluginPrettierRecommended,
275
- { name: "commencis/prettier" }
276
- ];
277
-
278
- // src/configs/typescript.ts
279
- import tseslint from "typescript-eslint";
280
- var typescript_default = [
281
- ...tseslint.configs.strict,
282
- ...tseslint.configs.stylistic,
283
- {
284
- name: "commencis/typescript",
285
- rules: {
286
- ...typescriptRules
287
- }
288
- }
289
- ];
290
-
291
- // src/configs/vue.ts
292
- var vue_default = [
293
- ...base_default,
294
- ...typescript_default,
295
- ...vuePluginConfig,
296
- ...prettier_default,
297
- {
298
- plugins: {
299
- "typescript-eslint": tseslint2.plugin
300
- },
301
- languageOptions: {
302
- parserOptions: {
303
- parser: tseslint2.parser,
304
- extraFileExtensions: [".vue"],
305
- sourceType: "module"
306
- }
307
- }
308
- },
309
- { name: "commencis/vue" }
310
- ];
311
- export {
312
- vue_default as default
313
- };
package/dist/index.d.ts DELETED
@@ -1,14 +0,0 @@
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 commencisReactNativeConfig } from './configs/react-native.js';
7
- export { default as commencisTypescriptConfig } from './configs/typescript.js';
8
- export { default as commencisVueConfig } from './configs/vue.js';
9
- import 'eslint';
10
- import './flatConfig-Cm6wkwA_.js';
11
-
12
- declare const defineConfig: typeof typescript_eslint.config;
13
-
14
- export { defineConfig };