@kazupon/eslint-config 0.40.0 → 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/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 {
@@ -16724,6 +16728,14 @@ interface OxlintOptions {
16724
16728
  * @default false
16725
16729
  */
16726
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[];
16727
16739
  }
16728
16740
  /**
16729
16741
  * `eslint-plugin-oxlint` and overrides configuration options
package/dist/index.mjs CHANGED
@@ -715,11 +715,13 @@ const md = markdown;
715
715
  async function oxlint(options = {}) {
716
716
  const { rules: overrideRules = {} } = options;
717
717
  const enableGlobalIgnore = options.enableGlobalIgnore ?? false;
718
+ const presets = options.presets ?? [];
718
719
  const oxlint$1 = await loadPlugin("eslint-plugin-oxlint");
719
720
  const customConfig = {
720
721
  name: "@kazupon/oxlint",
721
722
  rules: { ...overrideRules }
722
723
  };
724
+ const presetConfigs = collectOxlintPresetConfig(oxlint$1, presets);
723
725
  if (options.configFile) {
724
726
  const configsFromFile = oxlint$1.buildFromOxlintConfigFile(options.configFile, { withNursery: options.withNursery });
725
727
  const oxlintBaseConfig = configsFromFile.find((config) => config.name === "oxlint/from-oxlint-config");
@@ -734,9 +736,22 @@ async function oxlint(options = {}) {
734
736
  ignores
735
737
  },
736
738
  ...configsFromFile,
739
+ ...presetConfigs,
737
740
  customConfig
738
- ] : [...configsFromFile, customConfig];
739
- } else return [...oxlint$1.configs["flat/all"], 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;
740
755
  }
741
756
 
742
757
  //#endregion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kazupon/eslint-config",
3
3
  "description": "ESLint config for @kazupon",
4
- "version": "0.40.0",
4
+ "version": "0.41.0",
5
5
  "author": {
6
6
  "email": "kawakazu80@gmail.com",
7
7
  "name": "kazuya kawaguchi"