@1stg/eslint-config 12.0.1 → 12.0.2
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/CHANGELOG.md +7 -0
- package/lib/index.d.ts +18 -3
- package/lib/index.js +12 -2
- package/package.json +1 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 12.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#451](https://github.com/1stG/configs/pull/451) [`a70ca8c`](https://github.com/1stG/configs/commit/a70ca8c676dc39add61c4d7bd744d09624b342db) Thanks [@JounQin](https://github.com/JounQin)! - Annotate the default config type explicitly so TypeScript 6 can emit a portable
|
|
8
|
+
declaration, keeping `vue-tsc` happy.
|
|
9
|
+
|
|
3
10
|
## 12.0.1
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/lib/index.d.ts
CHANGED
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
import type { Linter } from 'eslint';
|
|
2
2
|
export interface EslintConfigOptions {
|
|
3
|
+
/** Lint Markdown/MDX. @default true */
|
|
3
4
|
markdown?: boolean;
|
|
5
|
+
/** Lint JSON/JSONC/JSON5. @default true */
|
|
4
6
|
jsonc?: boolean;
|
|
7
|
+
/** Lint YAML. @default true */
|
|
5
8
|
yaml?: boolean;
|
|
9
|
+
/** Lint TOML. @default true */
|
|
6
10
|
toml?: boolean;
|
|
11
|
+
/** Lint HTML with `eslint-plugin-markup` on Node >= 24. @default auto */
|
|
7
12
|
markup?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Lint JS/TS/JSX as well, with only rules Oxlint does not cover. @default installed
|
|
15
|
+
* `typescript-eslint`
|
|
16
|
+
*/
|
|
8
17
|
code?: boolean;
|
|
18
|
+
/** Extra ignore patterns. */
|
|
9
19
|
ignores?: string[];
|
|
10
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Build the flat ESLint config for the file types Oxlint does not parse.
|
|
23
|
+
*
|
|
24
|
+
* Every plugin is imported dynamically (and only when its option is enabled), so the config works
|
|
25
|
+
* with ESM-only plugins. ESLint awaits the returned promise before linting.
|
|
26
|
+
*/
|
|
11
27
|
export declare const defineConfig: ({ markdown, jsonc: jsoncEnabled, yaml, toml: tomlEnabled, code, markup, ignores, }?: EslintConfigOptions) => Promise<Linter.Config[]>;
|
|
12
|
-
declare const
|
|
13
|
-
export default
|
|
14
|
-
//# sourceMappingURL=index.d.ts.map
|
|
28
|
+
declare const config: Promise<Linter.Config[]>;
|
|
29
|
+
export default config;
|
package/lib/index.js
CHANGED
|
@@ -38,11 +38,13 @@ const DEFAULT_IGNORES = [
|
|
|
38
38
|
'**/*.log',
|
|
39
39
|
'**/*.patch',
|
|
40
40
|
'**/*.min.*',
|
|
41
|
+
// Oxlint owns code; stylelint owns styles; markuplint owns HTML.
|
|
41
42
|
CODE_IGNORES,
|
|
42
43
|
'**/*.vue',
|
|
43
44
|
'**/*.{css,less,sass,scss,styl,stylus}',
|
|
44
45
|
'**/*.html',
|
|
45
46
|
];
|
|
47
|
+
/** Check whether an optional peer plugin is installed. */
|
|
46
48
|
const toConfigs = (config) => Array.isArray(config) ? config : [config];
|
|
47
49
|
const withCodeFiles = (config) => { var _a; return (Object.assign(Object.assign({}, config), { files: (_a = config.files) !== null && _a !== void 0 ? _a : [CODE_IGNORES] })); };
|
|
48
50
|
const isInstalled = (name) => {
|
|
@@ -53,11 +55,18 @@ const isInstalled = (name) => {
|
|
|
53
55
|
return false;
|
|
54
56
|
}
|
|
55
57
|
};
|
|
58
|
+
/** Dynamic import that also unwraps a CommonJS default export. */
|
|
56
59
|
const load = (name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
60
|
var _a;
|
|
58
61
|
const mod = (yield import(__rewriteRelativeImportExtension(name, true)));
|
|
59
62
|
return ((_a = mod.default) !== null && _a !== void 0 ? _a : mod);
|
|
60
63
|
});
|
|
64
|
+
/**
|
|
65
|
+
* Build the flat ESLint config for the file types Oxlint does not parse.
|
|
66
|
+
*
|
|
67
|
+
* Every plugin is imported dynamically (and only when its option is enabled), so the config works
|
|
68
|
+
* with ESM-only plugins. ESLint awaits the returned promise before linting.
|
|
69
|
+
*/
|
|
61
70
|
export const defineConfig = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* ({ markdown = true, jsonc: jsoncEnabled = true, yaml = isInstalled('eslint-plugin-yml'), toml: tomlEnabled = isInstalled('eslint-plugin-toml'), code = isInstalled('typescript-eslint'), markup = supportsMarkup && isInstalled('eslint-plugin-markup'), ignores = [], } = {}) {
|
|
62
71
|
const defaultIgnores = DEFAULT_IGNORES.filter(pattern => (!markup || pattern !== '**/*.html') && (!code || pattern !== CODE_IGNORES));
|
|
63
72
|
const configs = [{ ignores: [...defaultIgnores, ...ignores] }];
|
|
@@ -70,6 +79,7 @@ export const defineConfig = (...args_1) => __awaiter(void 0, [...args_1], void 0
|
|
|
70
79
|
}
|
|
71
80
|
if (code) {
|
|
72
81
|
if (!isInstalled('typescript-eslint')) {
|
|
82
|
+
/* istanbul ignore next -- defensive guard for explicit code: true */
|
|
73
83
|
throw new Error('@1stg/eslint-config: `code` requires the `typescript-eslint` package');
|
|
74
84
|
}
|
|
75
85
|
const tseslint = yield load('typescript-eslint');
|
|
@@ -102,5 +112,5 @@ export const defineConfig = (...args_1) => __awaiter(void 0, [...args_1], void 0
|
|
|
102
112
|
}
|
|
103
113
|
return configs;
|
|
104
114
|
});
|
|
105
|
-
|
|
106
|
-
|
|
115
|
+
const config = defineConfig();
|
|
116
|
+
export default config;
|
package/package.json
CHANGED
package/lib/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ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