@luxass/eslint-config 4.19.0 → 5.0.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 CHANGED
@@ -263,6 +263,7 @@ Since flat config requires us to explicitly provide the plugin names (instead of
263
263
 
264
264
  | New Prefix | Original Prefix | Source Plugin |
265
265
  | --------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
266
+ | `import/*` | `import-lite/*` | [eslint-plugin-import-lite](https://github.com/9romise/eslint-plugin-import-lite) |
266
267
  | `node/*` | `n/*` | [eslint-plugin-n](https://github.com/eslint-community/eslint-plugin-n) |
267
268
  | `yaml/*` | `yml/*` | [eslint-plugin-yml](https://github.com/ota-meshi/eslint-plugin-yml) |
268
269
  | `ts/*` | `@typescript-eslint/*` | [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) |
package/dist/index.d.ts CHANGED
@@ -207,8 +207,12 @@ interface ImportsOptions {
207
207
  * @default true
208
208
  */
209
209
  stylistic?: boolean | StylisticConfig;
210
+ /**
211
+ * Overrides for the config.
212
+ */
213
+ overrides?: TypedFlatConfigItem["rules"];
210
214
  }
211
- declare function imports(_options?: ImportsOptions): Promise<TypedFlatConfigItem[]>;
215
+ declare function imports(options?: ImportsOptions): Promise<TypedFlatConfigItem[]>;
212
216
  //#endregion
213
217
  //#region src/configs/javascript.d.ts
214
218
  interface JavaScriptOptions {
@@ -1203,6 +1207,41 @@ interface RuleOptions {
1203
1207
  * @deprecated
1204
1208
  */
1205
1209
  'implicit-arrow-linebreak'?: Linter.RuleEntry<ImplicitArrowLinebreak>;
1210
+ /**
1211
+ * Enforce or ban the use of inline type-only markers for named imports.
1212
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/consistent-type-specifier-style/README.md
1213
+ */
1214
+ 'import/consistent-type-specifier-style'?: Linter.RuleEntry<ImportConsistentTypeSpecifierStyle>;
1215
+ /**
1216
+ * Ensure all imports appear before other statements.
1217
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/first/README.md
1218
+ */
1219
+ 'import/first'?: Linter.RuleEntry<ImportFirst>;
1220
+ /**
1221
+ * Enforce a newline after import statements.
1222
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/newline-after-import/README.md
1223
+ */
1224
+ 'import/newline-after-import'?: Linter.RuleEntry<ImportNewlineAfterImport>;
1225
+ /**
1226
+ * Forbid default exports.
1227
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/no-default-export/README.md
1228
+ */
1229
+ 'import/no-default-export'?: Linter.RuleEntry<[]>;
1230
+ /**
1231
+ * Forbid repeated import of the same module in multiple places.
1232
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/no-duplicates/README.md
1233
+ */
1234
+ 'import/no-duplicates'?: Linter.RuleEntry<ImportNoDuplicates>;
1235
+ /**
1236
+ * Forbid the use of mutable exports with `var` or `let`.
1237
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/no-mutable-exports/README.md
1238
+ */
1239
+ 'import/no-mutable-exports'?: Linter.RuleEntry<[]>;
1240
+ /**
1241
+ * Forbid named default exports.
1242
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/no-named-default/README.md
1243
+ */
1244
+ 'import/no-named-default'?: Linter.RuleEntry<[]>;
1206
1245
  /**
1207
1246
  * Enforce consistent indentation
1208
1247
  * @see https://eslint.org/docs/latest/rules/indent
@@ -8271,6 +8310,20 @@ type IdMatch = [] | [string] | [string, {
8271
8310
  }];
8272
8311
  // ----- implicit-arrow-linebreak -----
8273
8312
  type ImplicitArrowLinebreak = [] | [("beside" | "below")];
8313
+ // ----- import/consistent-type-specifier-style -----
8314
+ type ImportConsistentTypeSpecifierStyle = [] | [("top-level" | "inline" | "prefer-top-level")];
8315
+ // ----- import/first -----
8316
+ type ImportFirst = [] | [("absolute-first" | "disable-absolute-first")];
8317
+ // ----- import/newline-after-import -----
8318
+ type ImportNewlineAfterImport = [] | [{
8319
+ count?: number;
8320
+ exactCount?: boolean;
8321
+ considerComments?: boolean;
8322
+ }];
8323
+ // ----- import/no-duplicates -----
8324
+ type ImportNoDuplicates = [] | [{
8325
+ "prefer-inline"?: boolean;
8326
+ }];
8274
8327
  // ----- indent -----
8275
8328
  type Indent = [] | [("tab" | number)] | [("tab" | number), {
8276
8329
  SwitchCase?: number;
@@ -16452,6 +16505,12 @@ interface ConfigOptions {
16452
16505
  * @default true
16453
16506
  */
16454
16507
  unicorn?: boolean | UnicornOptions;
16508
+ /**
16509
+ * Options for eslint-plugin-import-lite.
16510
+ *
16511
+ * @default true
16512
+ */
16513
+ imports?: boolean | ImportsOptions;
16455
16514
  /**
16456
16515
  * Control to disable some rules in editors.
16457
16516
  * @default auto-detect based on the process.env
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ import process from "node:process";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import eslintCommentsPlugin from "@eslint-community/eslint-plugin-eslint-comments";
6
6
  import pluginAntfu from "eslint-plugin-antfu";
7
+ import pluginImportLite from "eslint-plugin-import-lite";
7
8
  import pluginUnusedImports from "eslint-plugin-unused-imports";
8
9
  import globals from "globals";
9
10
  import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
@@ -472,19 +473,6 @@ async function stylistic(options = {}) {
472
473
  after: true,
473
474
  before: false
474
475
  }],
475
- "style/padding-line-between-statements": [
476
- "error",
477
- {
478
- blankLine: "always",
479
- next: "*",
480
- prev: "import"
481
- },
482
- {
483
- blankLine: "any",
484
- next: "import",
485
- prev: "import"
486
- }
487
- ],
488
476
  "style/yield-star-spacing": ["error", {
489
477
  after: true,
490
478
  before: false
@@ -601,14 +589,25 @@ async function ignores(userIgnores = []) {
601
589
 
602
590
  //#endregion
603
591
  //#region src/configs/imports.ts
604
- async function imports(_options = {}) {
592
+ async function imports(options = {}) {
593
+ const { overrides = {}, stylistic: stylistic$1 = true } = options;
605
594
  return [{
606
595
  name: "luxass/imports",
607
- plugins: { antfu: pluginAntfu },
596
+ plugins: {
597
+ antfu: pluginAntfu,
598
+ import: pluginImportLite
599
+ },
608
600
  rules: {
609
601
  "antfu/import-dedupe": "error",
610
602
  "antfu/no-import-dist": "error",
611
- "antfu/no-import-node-modules-by-path": "error"
603
+ "antfu/no-import-node-modules-by-path": "error",
604
+ "import/consistent-type-specifier-style": ["error", "top-level"],
605
+ "import/first": "error",
606
+ "import/no-duplicates": "error",
607
+ "import/no-mutable-exports": "error",
608
+ "import/no-named-default": "error",
609
+ ...stylistic$1 ? { "import/newline-after-import": ["error", { count: 1 }] } : {},
610
+ ...overrides
612
611
  }
613
612
  }];
614
613
  }
@@ -2084,6 +2083,7 @@ const defaultPluginRenaming = {
2084
2083
  "@eslint-react/naming-convention": "react-naming-convention",
2085
2084
  "@stylistic": "style",
2086
2085
  "@typescript-eslint": "ts",
2086
+ "import-lite": "import",
2087
2087
  "n": "node",
2088
2088
  "vitest": "test",
2089
2089
  "yml": "yaml"
@@ -2099,7 +2099,7 @@ const defaultPluginRenaming = {
2099
2099
  * The merged ESLint configurations.
2100
2100
  */
2101
2101
  function luxass(options = {}, ...userConfigs) {
2102
- const { astro: enableAstro = false, autoRenamePlugins = true, exts = [], gitignore: enableGitignore = true, jsx: enableJsx = true, pnpm: enableCatalogs = false, react: enableReact = false, regexp: enableRegexp = true, tailwindcss: enableTailwindCSS = false, type: projectType = "app", typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
2102
+ const { astro: enableAstro = false, autoRenamePlugins = true, exts = [], gitignore: enableGitignore = true, imports: enableImports = true, jsx: enableJsx = true, pnpm: enableCatalogs = false, react: enableReact = false, regexp: enableRegexp = true, tailwindcss: enableTailwindCSS = false, type: projectType = "app", typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
2103
2103
  let isInEditor = options.isInEditor;
2104
2104
  if (isInEditor == null) {
2105
2105
  isInEditor = isInEditorEnv();
@@ -2122,6 +2122,10 @@ function luxass(options = {}, ...userConfigs) {
2122
2122
  isInEditor,
2123
2123
  overrides: getOverrides(options, "javascript")
2124
2124
  }), comments(), node(), jsdoc({ stylistic: stylisticOptions }), imports({ stylistic: stylisticOptions }), perfectionist());
2125
+ if (enableImports) configs$1.push(imports(enableImports === true ? { stylistic: stylisticOptions } : {
2126
+ stylistic: stylisticOptions,
2127
+ ...enableImports
2128
+ }));
2125
2129
  if (enableUnicorn) configs$1.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
2126
2130
  if (enableVue) exts.push("vue");
2127
2131
  if (enableJsx) configs$1.push(jsx());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxass/eslint-config",
3
- "version": "4.19.0",
3
+ "version": "5.0.0",
4
4
  "description": "ESLint config for @luxass",
5
5
  "type": "module",
6
6
  "author": {
@@ -92,6 +92,7 @@
92
92
  "eslint-flat-config-utils": "^2.1.0",
93
93
  "eslint-merge-processors": "^2.0.0",
94
94
  "eslint-plugin-antfu": "^3.1.1",
95
+ "eslint-plugin-import-lite": "^0.3.0",
95
96
  "eslint-plugin-jsdoc": "^50.7.1",
96
97
  "eslint-plugin-jsonc": "^2.20.1",
97
98
  "eslint-plugin-n": "^17.19.0",