@kazupon/eslint-config 0.39.1 → 0.41.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/README.md +1 -1
- package/dist/index.d.mts +24 -0
- package/dist/index.mjs +33 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -147,7 +147,7 @@ The following built-in preset configurations are supported:
|
|
|
147
147
|
| `css` | [`@eslint/css`](https://www.npmjs.com/package/@eslint/css) | yes |
|
|
148
148
|
| `html` | [`@html-eslint/eslint-plugin`](https://www.npmjs.com/package/@html-eslint/eslint-plugin) | yes |
|
|
149
149
|
| `deps` | [`eslint-plugin-barrel-files`](https://www.npmjs.com/package/eslint-plugin-barrel-files) | yes |
|
|
150
|
-
| `
|
|
150
|
+
| `oxlint` | [`eslint-plugin-oxlint`](https://www.npmjs.com/package/eslint-plugin-oxlint) | yes |
|
|
151
151
|
|
|
152
152
|
You can use `import` syntax:
|
|
153
153
|
|
package/dist/index.d.mts
CHANGED
|
@@ -16701,6 +16701,10 @@ declare const md: typeof markdown;
|
|
|
16701
16701
|
//#endregion
|
|
16702
16702
|
//#region src/configs/oxlint.d.ts
|
|
16703
16703
|
/**
|
|
16704
|
+
* Oxlint configuration preset names
|
|
16705
|
+
*/
|
|
16706
|
+
type OxlintConfigPreset = "recommended" | "all" | "import" | "unicorn" | "jsdoc" | "node" | "jest" | "vitest" | "typescript" | "vue" | "react" | "react-perf" | "jsx-a11y" | "tree-shaking" | "nextjs" | "pedantic" | "style" | "correctness" | "restriction" | "suspicious";
|
|
16707
|
+
/**
|
|
16704
16708
|
* Oxlint configuration options
|
|
16705
16709
|
*/
|
|
16706
16710
|
interface OxlintOptions {
|
|
@@ -16712,6 +16716,26 @@ interface OxlintOptions {
|
|
|
16712
16716
|
* enable nursery rules
|
|
16713
16717
|
*/
|
|
16714
16718
|
withNursery?: boolean;
|
|
16719
|
+
/**
|
|
16720
|
+
* enable global ignore patterns
|
|
16721
|
+
*
|
|
16722
|
+
* if true, it will use oxlint configure `ignorePatterns` as global ignore for ESLint flat config
|
|
16723
|
+
*
|
|
16724
|
+
* if the below PR released, this option will be removed and enabled by default
|
|
16725
|
+
*
|
|
16726
|
+
* @see https://github.com/oxc-project/eslint-plugin-oxlint/pull/564
|
|
16727
|
+
*
|
|
16728
|
+
* @default false
|
|
16729
|
+
*/
|
|
16730
|
+
enableGlobalIgnore?: boolean;
|
|
16731
|
+
/**
|
|
16732
|
+
* configuration preset name, which is one of `eslint-plugin-oxlint`'s provided presets
|
|
16733
|
+
*
|
|
16734
|
+
* @see https://github.com/oxc-project/eslint-plugin-oxlint?tab=readme-ov-file#all-configs
|
|
16735
|
+
*
|
|
16736
|
+
* @default `[]`
|
|
16737
|
+
*/
|
|
16738
|
+
presets?: OxlintConfigPreset[];
|
|
16715
16739
|
}
|
|
16716
16740
|
/**
|
|
16717
16741
|
* `eslint-plugin-oxlint` and overrides configuration options
|
package/dist/index.mjs
CHANGED
|
@@ -714,12 +714,44 @@ const md = markdown;
|
|
|
714
714
|
*/
|
|
715
715
|
async function oxlint(options = {}) {
|
|
716
716
|
const { rules: overrideRules = {} } = options;
|
|
717
|
+
const enableGlobalIgnore = options.enableGlobalIgnore ?? false;
|
|
718
|
+
const presets = options.presets ?? [];
|
|
717
719
|
const oxlint$1 = await loadPlugin("eslint-plugin-oxlint");
|
|
718
720
|
const customConfig = {
|
|
719
721
|
name: "@kazupon/oxlint",
|
|
720
722
|
rules: { ...overrideRules }
|
|
721
723
|
};
|
|
722
|
-
|
|
724
|
+
const presetConfigs = collectOxlintPresetConfig(oxlint$1, presets);
|
|
725
|
+
if (options.configFile) {
|
|
726
|
+
const configsFromFile = oxlint$1.buildFromOxlintConfigFile(options.configFile, { withNursery: options.withNursery });
|
|
727
|
+
const oxlintBaseConfig = configsFromFile.find((config) => config.name === "oxlint/from-oxlint-config");
|
|
728
|
+
let ignores = void 0;
|
|
729
|
+
if (oxlintBaseConfig && enableGlobalIgnore && oxlintBaseConfig.ignores) {
|
|
730
|
+
ignores = oxlintBaseConfig.ignores;
|
|
731
|
+
delete oxlintBaseConfig.ignores;
|
|
732
|
+
}
|
|
733
|
+
return enableGlobalIgnore && ignores ? [
|
|
734
|
+
{
|
|
735
|
+
name: "@kazupon/oxlint-global-ignore",
|
|
736
|
+
ignores
|
|
737
|
+
},
|
|
738
|
+
...configsFromFile,
|
|
739
|
+
...presetConfigs,
|
|
740
|
+
customConfig
|
|
741
|
+
] : [
|
|
742
|
+
...configsFromFile,
|
|
743
|
+
...presetConfigs,
|
|
744
|
+
customConfig
|
|
745
|
+
];
|
|
746
|
+
} else return [...presetConfigs, customConfig];
|
|
747
|
+
}
|
|
748
|
+
function collectOxlintPresetConfig(oxlint$1, presets) {
|
|
749
|
+
const results = [];
|
|
750
|
+
for (const preset of presets) {
|
|
751
|
+
const presetConfigs = oxlint$1.configs[`flat/${preset}`];
|
|
752
|
+
if (presetConfigs) results.push(presetConfigs[0]);
|
|
753
|
+
}
|
|
754
|
+
return results;
|
|
723
755
|
}
|
|
724
756
|
|
|
725
757
|
//#endregion
|