@1stg/eslint-config 12.0.0 → 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 CHANGED
@@ -1,5 +1,20 @@
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
+
10
+ ## 12.0.1
11
+
12
+ ### Patch Changes
13
+
14
+ - [#436](https://github.com/1stG/configs/pull/436) [`ac965ca`](https://github.com/1stG/configs/commit/ac965ca37c90f140ed42aa6d93ceb4154886e167) Thanks [@JounQin](https://github.com/JounQin)! - Import `eslint-plugin-oxlint` statically and always apply its disable list.
15
+ The `oxlint: false` option is removed because omitting Oxlint would silently
16
+ skip those checks; Oxlint itself remains required through the plugin peer.
17
+
3
18
  ## 12.0.0
4
19
 
5
20
  ### Major Changes
package/README.md CHANGED
@@ -25,7 +25,7 @@ export default defineConfig()
25
25
 
26
26
  `eslint-plugin-mdx`, `eslint-plugin-jsonc` and `eslint-plugin-oxlint` are
27
27
  installed by default, so Markdown/JSON(C) linting and the Oxlint rule-disable
28
- list are on. `eslint-plugin-yml` and `eslint-plugin-toml` are optional peers,
28
+ list are on. `eslint-plugin-oxlint` in turn requires `oxlint`. `eslint-plugin-yml` and `eslint-plugin-toml` are optional peers,
29
29
  enabled only when installed (`import.meta.resolve`). ESLint awaits the returned promise. Use
30
30
  `export default await defineConfig()` if your tool does not await it.
31
31
 
@@ -59,7 +59,6 @@ Use `defineConfig` only when you need options.
59
59
  | `yaml` | installed | Lint YAML when installed. |
60
60
  | `toml` | installed | Lint TOML when installed. |
61
61
  | `code` | installed `typescript-eslint` | Lint JS/TS/JSX with rules Oxlint does not cover. |
62
- | `oxlint` | `true` | Disable rules Oxlint already owns. |
63
62
  | `markup` | auto | Lint HTML with `eslint-plugin-markup` on Node >= 24 when installed. |
64
63
  | `ignores` | `[]` | Extra ignore patterns. |
65
64
 
package/lib/index.d.ts CHANGED
@@ -1,15 +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;
9
- oxlint?: boolean;
18
+ /** Extra ignore patterns. */
10
19
  ignores?: string[];
11
20
  }
12
- export declare const defineConfig: ({ markdown, jsonc: jsoncEnabled, yaml, toml: tomlEnabled, oxlint: oxlintEnabled, code, markup, ignores, }?: EslintConfigOptions) => Promise<Linter.Config[]>;
13
- declare const _default: Promise<Linter.Config<import("@eslint/core").RulesConfig>[]>;
14
- export default _default;
15
- //# sourceMappingURL=index.d.ts.map
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
+ */
27
+ export declare const defineConfig: ({ markdown, jsonc: jsoncEnabled, yaml, toml: tomlEnabled, code, markup, ignores, }?: EslintConfigOptions) => Promise<Linter.Config[]>;
28
+ declare const config: Promise<Linter.Config[]>;
29
+ export default config;
package/lib/index.js CHANGED
@@ -15,7 +15,9 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
15
15
  }
16
16
  return path;
17
17
  };
18
+ import oxlint from 'eslint-plugin-oxlint';
18
19
  const NODE_MAJOR = Number(process.versions.node.split('.')[0]);
20
+ const supportsMarkup = NODE_MAJOR >= 24;
19
21
  const CODE_IGNORES = '**/*.{cjs,cts,js,jsx,mjs,mts,ts,tsx}';
20
22
  const DEFAULT_IGNORES = [
21
23
  '**/.dsh/**',
@@ -36,11 +38,13 @@ const DEFAULT_IGNORES = [
36
38
  '**/*.log',
37
39
  '**/*.patch',
38
40
  '**/*.min.*',
41
+ // Oxlint owns code; stylelint owns styles; markuplint owns HTML.
39
42
  CODE_IGNORES,
40
43
  '**/*.vue',
41
44
  '**/*.{css,less,sass,scss,styl,stylus}',
42
45
  '**/*.html',
43
46
  ];
47
+ /** Check whether an optional peer plugin is installed. */
44
48
  const toConfigs = (config) => Array.isArray(config) ? config : [config];
45
49
  const withCodeFiles = (config) => { var _a; return (Object.assign(Object.assign({}, config), { files: (_a = config.files) !== null && _a !== void 0 ? _a : [CODE_IGNORES] })); };
46
50
  const isInstalled = (name) => {
@@ -51,16 +55,23 @@ const isInstalled = (name) => {
51
55
  return false;
52
56
  }
53
57
  };
58
+ /** Dynamic import that also unwraps a CommonJS default export. */
54
59
  const load = (name) => __awaiter(void 0, void 0, void 0, function* () {
55
60
  var _a;
56
61
  const mod = (yield import(__rewriteRelativeImportExtension(name, true)));
57
62
  return ((_a = mod.default) !== null && _a !== void 0 ? _a : mod);
58
63
  });
59
- 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'), oxlint: oxlintEnabled = true, code = isInstalled('typescript-eslint'), markup = NODE_MAJOR >= 24 && isInstalled('eslint-plugin-markup'), ignores = [], } = {}) {
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
+ */
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 = [], } = {}) {
60
71
  const defaultIgnores = DEFAULT_IGNORES.filter(pattern => (!markup || pattern !== '**/*.html') && (!code || pattern !== CODE_IGNORES));
61
72
  const configs = [{ ignores: [...defaultIgnores, ...ignores] }];
62
73
  if (markup) {
63
- if (NODE_MAJOR < 24) {
74
+ if (!supportsMarkup) {
64
75
  throw new Error('@1stg/eslint-config: `markup` requires Node.js >= 24 (eslint-plugin-markup@2)');
65
76
  }
66
77
  const markupPlugin = yield load('eslint-plugin-markup');
@@ -68,6 +79,7 @@ export const defineConfig = (...args_1) => __awaiter(void 0, [...args_1], void 0
68
79
  }
69
80
  if (code) {
70
81
  if (!isInstalled('typescript-eslint')) {
82
+ /* istanbul ignore next -- defensive guard for explicit code: true */
71
83
  throw new Error('@1stg/eslint-config: `code` requires the `typescript-eslint` package');
72
84
  }
73
85
  const tseslint = yield load('typescript-eslint');
@@ -81,10 +93,7 @@ export const defineConfig = (...args_1) => __awaiter(void 0, [...args_1], void 0
81
93
  configs.push(...toConfigs(regexp.configs['flat/recommended']).map(withCodeFiles));
82
94
  }
83
95
  }
84
- if (oxlintEnabled) {
85
- const oxlint = yield load('eslint-plugin-oxlint');
86
- configs.push(...toConfigs(oxlint.configs['flat/all']));
87
- }
96
+ configs.push(...toConfigs(oxlint.configs['flat/all']));
88
97
  if (markdown) {
89
98
  const mdx = yield load('eslint-plugin-mdx');
90
99
  configs.push(Object.assign(Object.assign({}, mdx.flat), { processor: mdx.createRemarkProcessor({ lintCodeBlocks: false }) }));
@@ -103,5 +112,5 @@ export const defineConfig = (...args_1) => __awaiter(void 0, [...args_1], void 0
103
112
  }
104
113
  return configs;
105
114
  });
106
- export default defineConfig();
107
- //# sourceMappingURL=index.js.map
115
+ const config = defineConfig();
116
+ export default config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1stg/eslint-config",
3
- "version": "12.0.0",
3
+ "version": "12.0.2",
4
4
  "type": "module",
5
5
  "description": "Personal but Shareable ESLint Configuration for the files Oxlint cannot lint",
6
6
  "repository": "git+https://github.com/1stG/configs.git",
@@ -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,CAAA;AAEpC,MAAM,WAAW,mBAAmB;IAElC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf,IAAI,CAAC,EAAE,OAAO,CAAA;IAEd,IAAI,CAAC,EAAE,OAAO,CAAA;IAEd,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB,IAAI,CAAC,EAAE,OAAO,CAAA;IAEd,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB;AA6ED,eAAO,MAAM,YAAY,+GAStB,mBAAmB,KAAQ,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CA6EpD,CAAA"}
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA8BA,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAE9D,MAAM,YAAY,GAAG,sCAAsC,CAAA;AAE3D,MAAM,eAAe,GAAG;IACtB,YAAY;IACZ,gBAAgB;IAChB,sBAAsB;IACtB,eAAe;IACf,aAAa;IACb,WAAW;IAC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