@luxass/eslint-config 4.10.0 → 4.10.1

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
@@ -88,9 +88,6 @@ Install [ESLint extension](https://marketplace.visualstudio.com/items?itemName=d
88
88
  ```jsonc
89
89
  // .vscode/settings.json
90
90
  {
91
- // will ensure that eslint can use the experimental flat config
92
- "eslint.experimental.useFlatConfig": true,
93
-
94
91
  // disable the default formatter
95
92
  "prettier.enable": false,
96
93
  "editor.formatOnSave": false,
@@ -103,15 +100,16 @@ Install [ESLint extension](https://marketplace.visualstudio.com/items?itemName=d
103
100
 
104
101
  // silent the stylistic rules in you IDE, but still auto fix them
105
102
  "eslint.rules.customizations": [
106
- { "rule": "style/*", "severity": "off" },
107
- { "rule": "*-indent", "severity": "off" },
108
- { "rule": "*-spacing", "severity": "off" },
109
- { "rule": "*-spaces", "severity": "off" },
110
- { "rule": "*-order", "severity": "off" },
111
- { "rule": "*-dangle", "severity": "off" },
112
- { "rule": "*-newline", "severity": "off" },
113
- { "rule": "*quotes", "severity": "off" },
114
- { "rule": "*semi", "severity": "off" }
103
+ { "rule": "style/*", "severity": "off", "fixable": true },
104
+ { "rule": "format/*", "severity": "off", "fixable": true },
105
+ { "rule": "*-indent", "severity": "off", "fixable": true },
106
+ { "rule": "*-spacing", "severity": "off", "fixable": true },
107
+ { "rule": "*-spaces", "severity": "off", "fixable": true },
108
+ { "rule": "*-order", "severity": "off", "fixable": true },
109
+ { "rule": "*-dangle", "severity": "off", "fixable": true },
110
+ { "rule": "*-newline", "severity": "off", "fixable": true },
111
+ { "rule": "*quotes", "severity": "off", "fixable": true },
112
+ { "rule": "*semi", "severity": "off", "fixable": true }
115
113
  ],
116
114
 
117
115
  // The following is optional.
@@ -134,6 +132,9 @@ Install [ESLint extension](https://marketplace.visualstudio.com/items?itemName=d
134
132
  "graphql",
135
133
  "astro",
136
134
  "css",
135
+ "less",
136
+ "scss",
137
+ "pcss",
137
138
  "postcss"
138
139
  ]
139
140
  }
package/dist/index.d.cts CHANGED
@@ -14119,14 +14119,14 @@ declare function combine(...configs: Awaitable<TypedFlatConfigItem | TypedFlatCo
14119
14119
  *
14120
14120
  * @example
14121
14121
  * ```ts
14122
- * import { renameRules } from '@luxass/eslint-config'
14122
+ * import { renameRules } from "@luxass/eslint-config";
14123
14123
  *
14124
14124
  * export default [{
14125
14125
  * rules: renameRules(
14126
14126
  * {
14127
- * '@typescript-eslint/indent': 'error'
14127
+ * "@typescript-eslint/indent": "error"
14128
14128
  * },
14129
- * { '@typescript-eslint': 'ts' }
14129
+ * { "@typescript-eslint": "ts" }
14130
14130
  * )
14131
14131
  * }]
14132
14132
  * ```
@@ -14137,23 +14137,111 @@ declare function renameRules(rules: Record<string, any>, map: Record<string, str
14137
14137
  *
14138
14138
  * @example
14139
14139
  * ```ts
14140
- * import { renamePluginInConfigs } from '@antfu/eslint-config'
14141
- * import someConfigs from './some-configs'
14140
+ * import { renamePluginInConfigs } from "@luxass/eslint-config";
14141
+ * import someConfigs from "./some-configs";
14142
14142
  *
14143
14143
  * export default renamePluginInConfigs(someConfigs, {
14144
- * '@typescript-eslint': 'ts',
14145
- * 'import-x': 'import',
14144
+ * "@typescript-eslint": "ts",
14145
+ * "import-x": "import",
14146
14146
  * })
14147
14147
  * ```
14148
14148
  */
14149
14149
  declare function renamePluginInConfigs(configs: TypedFlatConfigItem[], map: Record<string, string>): TypedFlatConfigItem[];
14150
+ /**
14151
+ * Convert a value to an array.
14152
+ * If the value is an array, return it as is.
14153
+ * Otherwise, return the value as the only element in an array.
14154
+ *
14155
+ * @param {T | T[]} value - Value to convert to an array.
14156
+ * @returns {T[]} - The value as an array.
14157
+ *
14158
+ * @example
14159
+ * ```ts
14160
+ * import { toArray } from "@luxass/eslint-config";
14161
+ *
14162
+ * toArray("foo") // ["foo"]
14163
+ * toArray(["foo"]) // ["foo"]
14164
+ * ```
14165
+ */
14150
14166
  declare function toArray<T>(value: T | T[]): T[];
14167
+ /**
14168
+ * Import a module and return the default export.
14169
+ * If the module does not have a default export, return the module itself.
14170
+ *
14171
+ * @param {Promise<T>} m - Module to import.
14172
+ * @returns {Promise<T extends { default: infer U } ? U : T>} - The default export or the module itself.
14173
+ * @template T
14174
+ *
14175
+ * @example
14176
+ * ```ts
14177
+ * import { interop } from "@luxass/eslint-config";
14178
+ *
14179
+ * const module = await interop(import("module"));
14180
+ * ```
14181
+ */
14151
14182
  declare function interop<T>(m: Awaitable<T>): Promise<T extends {
14152
14183
  default: infer U;
14153
14184
  } ? U : T>;
14185
+ /**
14186
+ * Ensure that packages are installed.
14187
+ * If the packages are not installed, prompt the user to install them.
14188
+ *
14189
+ * @param {string[]} packages - Packages to ensure are installed.
14190
+ * @returns {Promise<void>} - A promise that resolves when the packages are installed.
14191
+ *
14192
+ * @example
14193
+ * ```ts
14194
+ * import { ensure } from "@luxass/eslint-config";
14195
+ *
14196
+ * await ensure(["eslint-plugin-jsdoc"]);
14197
+ * ```
14198
+ */
14154
14199
  declare function ensure(packages: (string | undefined)[]): Promise<void>;
14155
14200
  type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
14201
+ /**
14202
+ * Resolve sub-options from a config options object.
14203
+ *
14204
+ * @param {ConfigOptions} options - The config options object.
14205
+ * @template K - The key of the sub-options to resolve.
14206
+ * @param {K} key - The key of the sub-options to resolve.
14207
+ * @returns {ResolvedOptions<ConfigOptions[K]>} - The resolved sub-options.
14208
+ *
14209
+ * @example
14210
+ * ```ts
14211
+ * import { resolveSubOptions } from "@luxass/eslint-config";
14212
+ *
14213
+ * const options = {
14214
+ * foo: {
14215
+ * bar: true,
14216
+ * },
14217
+ * };
14218
+ *
14219
+ * const subOptions = resolveSubOptions(options, "foo");
14220
+ * ```
14221
+ */
14156
14222
  declare function resolveSubOptions<K extends keyof ConfigOptions>(options: ConfigOptions, key: K): ResolvedOptions<ConfigOptions[K]>;
14223
+ /**
14224
+ * Get overrides from a config options object.
14225
+ * @param {ConfigOptions} options The config options object.
14226
+ * @template K The key of the sub-options to resolve.
14227
+ * @param {K} key The key of the sub-options to resolve.
14228
+ * @returns {Partial<Linter.RulesRecord & RuleOptions>} The overrides.
14229
+ *
14230
+ * @example
14231
+ * ```ts
14232
+ * import { getOverrides } from "@luxass/eslint-config";
14233
+ *
14234
+ * const options = {
14235
+ * overrides: {
14236
+ * rules: {
14237
+ * "no-console": "off",
14238
+ * },
14239
+ * },
14240
+ * };
14241
+ *
14242
+ * const overrides = getOverrides(options, "overrides");
14243
+ * ```
14244
+ */
14157
14245
  declare function getOverrides<K extends keyof ConfigOptions>(options: ConfigOptions, key: K): Partial<Linter.RulesRecord & RuleOptions>;
14158
14246
 
14159
14247
  export { type AstroOptions, type Awaitable, type ConfigNames, type ConfigOptions, type FormattersOptions, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_NEXTJS_OG, GLOB_NEXTJS_ROUTES, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type ImportsOptions, type JSDOCOptions, type JSONOptions, type JavaScriptOptions, type MarkdownOptions, type ProjectType, type ReactOptions, type RegExpOptions, type ResolvedOptions, type Rules, type StylisticConfig, type StylisticOptions, type TOMLOptions, type TailwindCSSOptions, type TestOptions, type TypeScriptOptions, type TypedFlatConfigItem, type UnoCSSOptions, type UserConfigItem, type VueOptions, type YAMLOptions, astro, combine, comments, luxass as default, ensure, formatters, getOverrides, ignores, imports, interop, javascript, jsdoc, jsonc, jsx, luxass, markdown, node, parserPlain, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, tailwindcss, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
package/dist/index.d.ts CHANGED
@@ -14119,14 +14119,14 @@ declare function combine(...configs: Awaitable<TypedFlatConfigItem | TypedFlatCo
14119
14119
  *
14120
14120
  * @example
14121
14121
  * ```ts
14122
- * import { renameRules } from '@luxass/eslint-config'
14122
+ * import { renameRules } from "@luxass/eslint-config";
14123
14123
  *
14124
14124
  * export default [{
14125
14125
  * rules: renameRules(
14126
14126
  * {
14127
- * '@typescript-eslint/indent': 'error'
14127
+ * "@typescript-eslint/indent": "error"
14128
14128
  * },
14129
- * { '@typescript-eslint': 'ts' }
14129
+ * { "@typescript-eslint": "ts" }
14130
14130
  * )
14131
14131
  * }]
14132
14132
  * ```
@@ -14137,23 +14137,111 @@ declare function renameRules(rules: Record<string, any>, map: Record<string, str
14137
14137
  *
14138
14138
  * @example
14139
14139
  * ```ts
14140
- * import { renamePluginInConfigs } from '@antfu/eslint-config'
14141
- * import someConfigs from './some-configs'
14140
+ * import { renamePluginInConfigs } from "@luxass/eslint-config";
14141
+ * import someConfigs from "./some-configs";
14142
14142
  *
14143
14143
  * export default renamePluginInConfigs(someConfigs, {
14144
- * '@typescript-eslint': 'ts',
14145
- * 'import-x': 'import',
14144
+ * "@typescript-eslint": "ts",
14145
+ * "import-x": "import",
14146
14146
  * })
14147
14147
  * ```
14148
14148
  */
14149
14149
  declare function renamePluginInConfigs(configs: TypedFlatConfigItem[], map: Record<string, string>): TypedFlatConfigItem[];
14150
+ /**
14151
+ * Convert a value to an array.
14152
+ * If the value is an array, return it as is.
14153
+ * Otherwise, return the value as the only element in an array.
14154
+ *
14155
+ * @param {T | T[]} value - Value to convert to an array.
14156
+ * @returns {T[]} - The value as an array.
14157
+ *
14158
+ * @example
14159
+ * ```ts
14160
+ * import { toArray } from "@luxass/eslint-config";
14161
+ *
14162
+ * toArray("foo") // ["foo"]
14163
+ * toArray(["foo"]) // ["foo"]
14164
+ * ```
14165
+ */
14150
14166
  declare function toArray<T>(value: T | T[]): T[];
14167
+ /**
14168
+ * Import a module and return the default export.
14169
+ * If the module does not have a default export, return the module itself.
14170
+ *
14171
+ * @param {Promise<T>} m - Module to import.
14172
+ * @returns {Promise<T extends { default: infer U } ? U : T>} - The default export or the module itself.
14173
+ * @template T
14174
+ *
14175
+ * @example
14176
+ * ```ts
14177
+ * import { interop } from "@luxass/eslint-config";
14178
+ *
14179
+ * const module = await interop(import("module"));
14180
+ * ```
14181
+ */
14151
14182
  declare function interop<T>(m: Awaitable<T>): Promise<T extends {
14152
14183
  default: infer U;
14153
14184
  } ? U : T>;
14185
+ /**
14186
+ * Ensure that packages are installed.
14187
+ * If the packages are not installed, prompt the user to install them.
14188
+ *
14189
+ * @param {string[]} packages - Packages to ensure are installed.
14190
+ * @returns {Promise<void>} - A promise that resolves when the packages are installed.
14191
+ *
14192
+ * @example
14193
+ * ```ts
14194
+ * import { ensure } from "@luxass/eslint-config";
14195
+ *
14196
+ * await ensure(["eslint-plugin-jsdoc"]);
14197
+ * ```
14198
+ */
14154
14199
  declare function ensure(packages: (string | undefined)[]): Promise<void>;
14155
14200
  type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
14201
+ /**
14202
+ * Resolve sub-options from a config options object.
14203
+ *
14204
+ * @param {ConfigOptions} options - The config options object.
14205
+ * @template K - The key of the sub-options to resolve.
14206
+ * @param {K} key - The key of the sub-options to resolve.
14207
+ * @returns {ResolvedOptions<ConfigOptions[K]>} - The resolved sub-options.
14208
+ *
14209
+ * @example
14210
+ * ```ts
14211
+ * import { resolveSubOptions } from "@luxass/eslint-config";
14212
+ *
14213
+ * const options = {
14214
+ * foo: {
14215
+ * bar: true,
14216
+ * },
14217
+ * };
14218
+ *
14219
+ * const subOptions = resolveSubOptions(options, "foo");
14220
+ * ```
14221
+ */
14156
14222
  declare function resolveSubOptions<K extends keyof ConfigOptions>(options: ConfigOptions, key: K): ResolvedOptions<ConfigOptions[K]>;
14223
+ /**
14224
+ * Get overrides from a config options object.
14225
+ * @param {ConfigOptions} options The config options object.
14226
+ * @template K The key of the sub-options to resolve.
14227
+ * @param {K} key The key of the sub-options to resolve.
14228
+ * @returns {Partial<Linter.RulesRecord & RuleOptions>} The overrides.
14229
+ *
14230
+ * @example
14231
+ * ```ts
14232
+ * import { getOverrides } from "@luxass/eslint-config";
14233
+ *
14234
+ * const options = {
14235
+ * overrides: {
14236
+ * rules: {
14237
+ * "no-console": "off",
14238
+ * },
14239
+ * },
14240
+ * };
14241
+ *
14242
+ * const overrides = getOverrides(options, "overrides");
14243
+ * ```
14244
+ */
14157
14245
  declare function getOverrides<K extends keyof ConfigOptions>(options: ConfigOptions, key: K): Partial<Linter.RulesRecord & RuleOptions>;
14158
14246
 
14159
14247
  export { type AstroOptions, type Awaitable, type ConfigNames, type ConfigOptions, type FormattersOptions, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_NEXTJS_OG, GLOB_NEXTJS_ROUTES, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type ImportsOptions, type JSDOCOptions, type JSONOptions, type JavaScriptOptions, type MarkdownOptions, type ProjectType, type ReactOptions, type RegExpOptions, type ResolvedOptions, type Rules, type StylisticConfig, type StylisticOptions, type TOMLOptions, type TailwindCSSOptions, type TestOptions, type TypeScriptOptions, type TypedFlatConfigItem, type UnoCSSOptions, type UserConfigItem, type VueOptions, type YAMLOptions, astro, combine, comments, luxass as default, ensure, formatters, getOverrides, ignores, imports, interop, javascript, jsdoc, jsonc, jsx, luxass, markdown, node, parserPlain, react, regexp, renamePluginInConfigs, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, tailwindcss, test, toArray, toml, typescript, unicorn, unocss, vue, yaml };
package/dist/index.js CHANGED
@@ -470,7 +470,7 @@ async function imports(options = {}) {
470
470
 
471
471
  // src/configs/javascript.ts
472
472
  import globals from "globals";
473
- import pluginUnusedImports from "eslint-plugin-unused-imports";
473
+ import { default as pluginUnusedImports } from "eslint-plugin-unused-imports";
474
474
  import pluginAntfu2 from "eslint-plugin-antfu";
475
475
  async function javascript(options = {}) {
476
476
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxass/eslint-config",
3
- "version": "4.10.0",
3
+ "version": "4.10.1",
4
4
  "description": "ESLint config for @luxass",
5
5
  "type": "module",
6
6
  "author": {
@@ -12,7 +12,7 @@
12
12
  "license": "MIT",
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "https://github.com/luxass/eslint-config.git"
15
+ "url": "git+https://github.com/luxass/eslint-config.git"
16
16
  },
17
17
  "keywords": [
18
18
  "eslint",