@kazupon/eslint-config 0.37.2 → 0.38.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/dist/index.d.ts +4 -0
- package/dist/index.js +48 -33
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,10 @@ interface OverridesOptions<Rules = Linter.Config["rules"]> {
|
|
|
32
32
|
*/
|
|
33
33
|
rules?: Rules;
|
|
34
34
|
/**
|
|
35
|
+
* Override globals
|
|
36
|
+
*/
|
|
37
|
+
globals?: ESLint.Environment["globals"];
|
|
38
|
+
/**
|
|
35
39
|
* Override parser options
|
|
36
40
|
*/
|
|
37
41
|
parserOptions?: ESLint.Environment["parserOptions"];
|
package/dist/index.js
CHANGED
|
@@ -25,34 +25,48 @@ function defineConfig(...configs) {
|
|
|
25
25
|
* @author kazuya kawaguchi (a.k.a. `@kazupon`)
|
|
26
26
|
* @license MIT
|
|
27
27
|
*/
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
28
|
+
const EXT_JS = "?([cm])js";
|
|
29
|
+
const EXT_JSX = "?([cm])jsx";
|
|
30
|
+
const EXT_TS = "?([cm])ts";
|
|
31
|
+
const EXT_TSX = "?([cm])tsx";
|
|
32
|
+
const EXT_JSON = "json";
|
|
33
|
+
const EXT_JSON5 = "json5";
|
|
34
|
+
const EXT_JSONC = "jsonc";
|
|
35
|
+
const EXT_YAML = "y?(a)ml";
|
|
36
|
+
const EXT_TOML = "toml";
|
|
37
|
+
const EXT_VUE = "vue";
|
|
38
|
+
const EXT_SVELTE = "svelte";
|
|
39
|
+
const EXT_MD = "md";
|
|
40
|
+
const EXT_HTML = "html";
|
|
41
|
+
const EXT_CSS = "css";
|
|
42
|
+
const GLOB_JS = `**/*.${EXT_JS}`;
|
|
43
|
+
const GLOB_JSX = `**/*.${EXT_JSX}`;
|
|
44
|
+
const GLOB_TS = `**/*.${EXT_TS}`;
|
|
45
|
+
const GLOB_TSX = `**/*.${EXT_TSX}`;
|
|
46
|
+
const GLOB_JSON = `**/*.${EXT_JSON}`;
|
|
47
|
+
const GLOB_JSON5 = `**/*.${EXT_JSON5}`;
|
|
48
|
+
const GLOB_JSONC = `**/*.${EXT_JSONC}`;
|
|
49
|
+
const GLOB_YAML = `**/*.${EXT_YAML}`;
|
|
50
|
+
const GLOB_TOML = `**/*.${EXT_TOML}`;
|
|
51
|
+
const GLOB_VUE = `**/*.${EXT_VUE}`;
|
|
52
|
+
const GLOB_SVELTE = `**/*.${EXT_SVELTE}`;
|
|
53
|
+
const GLOB_MARKDOWN = `**/*.${EXT_MD}`;
|
|
54
|
+
const GLOB_HTML = `**/*.${EXT_HTML}`;
|
|
55
|
+
const GLOB_CSS = `**/*.${EXT_CSS}`;
|
|
56
|
+
const SRC_EXT = "?([cm])[jt]s?(x)";
|
|
57
|
+
const GLOB_SRC = `**/*.${SRC_EXT}`;
|
|
44
58
|
const GLOB_TESTS = [
|
|
45
|
-
`**/test/**/*.${
|
|
46
|
-
`**/tests/**/*.${
|
|
47
|
-
`**/spec/**/*.${
|
|
48
|
-
`**/specs/**/*.${
|
|
49
|
-
`**/e2e/**/*.${
|
|
50
|
-
`**/__tests__/**/*.${
|
|
51
|
-
`**/__test__/**/*.${
|
|
52
|
-
`**/*.spec.${
|
|
53
|
-
`**/*.test.${
|
|
59
|
+
`**/test/**/*.${SRC_EXT}`,
|
|
60
|
+
`**/tests/**/*.${SRC_EXT}`,
|
|
61
|
+
`**/spec/**/*.${SRC_EXT}`,
|
|
62
|
+
`**/specs/**/*.${SRC_EXT}`,
|
|
63
|
+
`**/e2e/**/*.${SRC_EXT}`,
|
|
64
|
+
`**/__tests__/**/*.${SRC_EXT}`,
|
|
65
|
+
`**/__test__/**/*.${SRC_EXT}`,
|
|
66
|
+
`**/*.spec.${SRC_EXT}`,
|
|
67
|
+
`**/*.test.${SRC_EXT}`
|
|
54
68
|
];
|
|
55
|
-
const GLOB_TESTS_TYPE = [`**/*.test-d.${
|
|
69
|
+
const GLOB_TESTS_TYPE = [`**/*.test-d.${SRC_EXT}`, `**/*.spec-d.${SRC_EXT}`];
|
|
56
70
|
|
|
57
71
|
//#endregion
|
|
58
72
|
//#region src/utils.ts
|
|
@@ -336,7 +350,7 @@ async function imports(options = {}) {
|
|
|
336
350
|
* @returns {Promise<Linter.Config[]>} eslint flat configurations with `@eslint/js` and overrides
|
|
337
351
|
*/
|
|
338
352
|
async function javascript(options = {}) {
|
|
339
|
-
const { rules: overrideRules = {} } = options;
|
|
353
|
+
const { rules: overrideRules = {}, globals: overrideGlobals = {} } = options;
|
|
340
354
|
return [(
|
|
341
355
|
/**
|
|
342
356
|
* {
|
|
@@ -358,7 +372,8 @@ async function javascript(options = {}) {
|
|
|
358
372
|
...globals.es2022,
|
|
359
373
|
document: "readonly",
|
|
360
374
|
navigator: "readonly",
|
|
361
|
-
window: "readonly"
|
|
375
|
+
window: "readonly",
|
|
376
|
+
...overrideGlobals
|
|
362
377
|
},
|
|
363
378
|
parserOptions: {
|
|
364
379
|
ecmaFeatures: { jsx: true },
|
|
@@ -874,7 +889,11 @@ async function typescript(options = {}) {
|
|
|
874
889
|
return [
|
|
875
890
|
...ts.configs.recommendedTypeChecked.map((config) => {
|
|
876
891
|
const mapped = { ...config };
|
|
877
|
-
|
|
892
|
+
mapped.files = [...config.files ?? files, ...[
|
|
893
|
+
EXT_TS,
|
|
894
|
+
EXT_TSX,
|
|
895
|
+
...extraFileExtensions
|
|
896
|
+
].map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)];
|
|
878
897
|
return mapped;
|
|
879
898
|
}),
|
|
880
899
|
{
|
|
@@ -892,10 +911,6 @@ async function typescript(options = {}) {
|
|
|
892
911
|
],
|
|
893
912
|
...ts.configs.disableTypeChecked
|
|
894
913
|
},
|
|
895
|
-
{
|
|
896
|
-
name: "@kazupon/typescipt/typescript-eslint/overrides-for-disable-type-checked",
|
|
897
|
-
rules: { ...ts.configs.disableTypeChecked.rules }
|
|
898
|
-
},
|
|
899
914
|
{
|
|
900
915
|
name: "@kazupon/typescipt/typescript-eslint",
|
|
901
916
|
files,
|