diff --git a/src/eslint/configs/index.ts b/src/eslint/configs/index.ts index 2e8204cd..73ad392c 100644 --- a/src/eslint/configs/index.ts +++ b/src/eslint/configs/index.ts @@ -19,5 +19,6 @@ export * from "./toml.ts"; export * from "./typescript.ts"; export * from "./unicorn.ts"; export * from "./unocss.ts"; +export * from "./unused-imports.ts"; export * from "./vue.ts"; export * from "./yml.ts"; diff --git a/src/eslint/configs/markdown.ts b/src/eslint/configs/markdown.ts index 95045832..5c1f1268 100644 --- a/src/eslint/configs/markdown.ts +++ b/src/eslint/configs/markdown.ts @@ -40,6 +40,8 @@ export function markdown(options: MarkdownOptions = {}): Config[] { "n/no-unpublished-import": "off", "n/no-unpublished-require": "off", "unicorn/prefer-module": "off", + "unused-imports/no-unused-imports": "off", + "unused-imports/no-unused-vars": "off", "vue/no-unused-emit-declarations": "off", ...rules, diff --git a/src/eslint/configs/unused-imports.ts b/src/eslint/configs/unused-imports.ts new file mode 100644 index 00000000..5b08f562 --- /dev/null +++ b/src/eslint/configs/unused-imports.ts @@ -0,0 +1,55 @@ +import { + GLOB_DTS, + GLOB_SCRIPT, + GLOB_TS, + GLOB_TSX, + GLOB_VUE, +} from "../../constants.ts"; +import { hasTypeScript, hasVue } from "../../env.ts"; +import { pluginUnusedImports } from "../plugins.ts"; +import type { Config, UnusedImportsOptions } from "../types.ts"; + +export function unusedImports(options: UnusedImportsOptions = {}): Config[] { + const { + files = [GLOB_SCRIPT, GLOB_VUE], + rules = {}, + typescriptFiles = hasTypeScript && hasVue + ? [GLOB_DTS, GLOB_TS, GLOB_TSX, GLOB_VUE] + : [GLOB_DTS, GLOB_TS, GLOB_TSX], + typescriptRules = {}, + } = options; + return [ + { + name: "base/unused-imports", + files, + plugins: { + "unused-imports": pluginUnusedImports, + }, + rules: { + "no-unused-vars": "off", + "unused-imports/no-unused-imports": "error", + "unused-imports/no-unused-vars": [ + "warn", + { + args: "after-used", + argsIgnorePattern: "^_", + ignoreRestSiblings: true, + vars: "all", + varsIgnorePattern: "^_", + }, + ], + + ...rules, + }, + }, + { + name: "base/unused-imports/typescript", + files: typescriptFiles, + rules: { + "@typescript-eslint/no-unused-vars": "off", + + ...typescriptRules, + }, + }, + ]; +} diff --git a/src/eslint/factory.ts b/src/eslint/factory.ts index 59d8df9d..1e61324c 100644 --- a/src/eslint/factory.ts +++ b/src/eslint/factory.ts @@ -21,6 +21,7 @@ import { typescript, unicorn, unocss, + unusedImports, vue, yml, } from "./configs/index.ts"; @@ -32,11 +33,16 @@ export function eslint( userConfigs: (Config | Config[])[] = [], ): Config[] { const { - command: commandOptions, + // ---- Ignores ---- gitignore: gitignoreOptions, ignores: ignoresOptions, - imports: importsOptions, + // ---- Languages ---- javascript: javascriptOptions, + typescript: typescriptOptions, + // ---- Base ---- + command: commandOptions, + imports: importsOptions, + unusedImports: unusedImportsOptions, jsdoc: jsdocOptions, jsonc: jsoncOptions, markdown: markdownOptions, @@ -50,7 +56,7 @@ export function eslint( regexp: regexpOptions, tailwindcss: tailwindcssOptions, toml: tomlOptions, - typescript: typescriptOptions, + unicorn: unicornOptions, unocss: unocssOptions, vue: vueOptions, @@ -66,6 +72,7 @@ export function eslint( if (isBoolean(gitignoreOptions)) configs.push(gitignore()); else configs.push(gitignore(gitignoreOptions)); } + // ignores if (ignoresOptions) { if (isBoolean(ignoresOptions)) configs.push(ignores()); @@ -88,34 +95,28 @@ export function eslint( // ---- Base ---- + // command + if (commandOptions) { + if (isBoolean(commandOptions)) configs.push(command()); + else configs.push(command(commandOptions)); + } + // JSDoc if (jsdocOptions) { if (isBoolean(jsdocOptions)) configs.push(jsdoc()); else configs.push(jsdoc(jsdocOptions)); } - // Command - if (commandOptions) { - if (isBoolean(commandOptions)) configs.push(command()); - else configs.push(command(commandOptions)); - } - // imports if (importsOptions) { if (isBoolean(importsOptions)) configs.push(imports()); else configs.push(imports(importsOptions)); } - // Node - if (nodeOptions) { - if (isBoolean(nodeOptions)) configs.push(node()); - else configs.push(node(nodeOptions)); - } - - // Perfectionist - if (perfectionistOptions) { - if (isBoolean(perfectionistOptions)) configs.push(perfectionist()); - else configs.push(perfectionist(perfectionistOptions)); + // unused imports + if (unusedImportsOptions) { + if (isBoolean(unusedImportsOptions)) configs.push(unusedImports()); + else configs.push(unusedImports(unusedImportsOptions)); } // Promise @@ -130,7 +131,19 @@ export function eslint( else configs.push(regexp(regexpOptions)); } - // Unicorn + // Node + if (nodeOptions) { + if (isBoolean(nodeOptions)) configs.push(node()); + else configs.push(node(nodeOptions)); + } + + // perfectionist + if (perfectionistOptions) { + if (isBoolean(perfectionistOptions)) configs.push(perfectionist()); + else configs.push(perfectionist(perfectionistOptions)); + } + + // unicorn if (unicornOptions) { if (isBoolean(unicornOptions)) configs.push(unicorn()); else configs.push(unicorn(unicornOptions)); @@ -180,7 +193,7 @@ export function eslint( else configs.push(unocss(unocssOptions)); } - // ---- Specify File Type ---- + // ---- Special File Type ---- // Markdown if (markdownOptions) { diff --git a/src/eslint/plugins.ts b/src/eslint/plugins.ts index b4a6af59..da85786e 100644 --- a/src/eslint/plugins.ts +++ b/src/eslint/plugins.ts @@ -1,26 +1,31 @@ import { fixupPluginRules } from "@eslint/compat"; + import * as _configGitignore from "eslint-config-flat-gitignore"; + +import * as _parserBabel from "@babel/eslint-parser"; + +import * as _parserTypeScript from "@typescript-eslint/parser"; +import * as _pluginTypeScript from "@typescript-eslint/eslint-plugin"; + import * as _configCommand from "eslint-plugin-command/config"; -import * as _pluginImportX from "eslint-plugin-import-x"; + import * as _pluginJsdoc from "eslint-plugin-jsdoc"; -import * as _pluginJsonc from "eslint-plugin-jsonc"; + +import * as _pluginImportX from "eslint-plugin-import-x"; + +import * as _pluginUnusedImports from "eslint-plugin-unused-imports"; + /* @ts-expect-error missing types */ -import * as _pluginMarkdown from "eslint-plugin-markdown"; +import * as _pluginPromise from "eslint-plugin-promise"; + +import * as _pluginRegexp from "eslint-plugin-regexp"; + import * as _pluginN from "eslint-plugin-n"; -import * as _pluginPackageJson from "eslint-plugin-package-json"; + import _pluginPerfectionist from "eslint-plugin-perfectionist"; -import * as _pluginRegexp from "eslint-plugin-regexp"; -import * as _pluginTypeScript from "@typescript-eslint/eslint-plugin"; + import * as _pluginUnicorn from "eslint-plugin-unicorn"; -import _pluginUnocss from "@unocss/eslint-plugin"; -import * as _pluginVue from "eslint-plugin-vue"; -/* @ts-expect-error missing types */ -import * as _pluginVueScopedCss from "eslint-plugin-vue-scoped-css"; -/* @ts-expect-error missing types */ -import * as _pluginNuxt2 from "eslint-plugin-nuxt"; -import * as _pluginNuxt3 from "@nuxt/eslint-plugin"; -/* @ts-expect-error missing types */ -import * as _pluginPromise from "eslint-plugin-promise"; + import * as _pluginReactX from "eslint-plugin-react-x"; import * as _pluginReactDom from "eslint-plugin-react-dom"; import * as _pluginReactWebApi from "eslint-plugin-react-web-api"; @@ -32,69 +37,104 @@ import * as _pluginReactHooks from "eslint-plugin-react-hooks"; import * as _pluginReactPerf from "eslint-plugin-react-perf"; /* @ts-expect-error missing types */ import * as _pluginReactRefresh from "eslint-plugin-react-refresh"; + /* @ts-expect-error missing types */ import * as _pluginReactNative from "eslint-plugin-react-native"; + /* @ts-expect-error missing types */ import * as _pluginNext from "@next/eslint-plugin-next"; + +import * as _parserVue from "vue-eslint-parser"; +import * as _pluginVue from "eslint-plugin-vue"; +/* @ts-expect-error missing types */ +import * as _pluginVueScopedCss from "eslint-plugin-vue-scoped-css"; + +/* @ts-expect-error missing types */ +import * as _pluginNuxt2 from "eslint-plugin-nuxt"; +import * as _pluginNuxt3 from "@nuxt/eslint-plugin"; + /* @ts-expect-error missing types */ import * as _pluginTailwindcss from "eslint-plugin-tailwindcss"; -import * as _pluginToml from "eslint-plugin-toml"; -import * as _pluginYml from "eslint-plugin-yml"; -import * as _parserBabel from "@babel/eslint-parser"; + +import _pluginUnocss from "@unocss/eslint-plugin"; + +/* @ts-expect-error missing types */ +import * as _pluginMarkdown from "eslint-plugin-markdown"; + import * as _parserJsonc from "jsonc-eslint-parser"; +import * as _pluginJsonc from "eslint-plugin-jsonc"; + +import * as _pluginPackageJson from "eslint-plugin-package-json"; + import * as _parserToml from "toml-eslint-parser"; -import * as _parserTypeScript from "@typescript-eslint/parser"; -import * as _parserVue from "vue-eslint-parser"; +import * as _pluginToml from "eslint-plugin-toml"; + +import * as _pluginYml from "eslint-plugin-yml"; import * as _parserYml from "yaml-eslint-parser"; + import { interopDefault } from "../utils.ts"; import type { ESLint } from "eslint"; +// ---- Ignores ---- + +// gitignore export const configGitignore = interopDefault(_configGitignore); -export const configCommand = interopDefault(_configCommand); -export const pluginImportX = interopDefault( - _pluginImportX, + +// ---- Languages ---- + +// JavaScript +export const parserBabel = interopDefault(_parserBabel); + +// TypeScript +export const parserTypeScript = interopDefault(_parserTypeScript); +export const pluginTypeScript = interopDefault( + _pluginTypeScript, ) as unknown as ESLint.Plugin; + +// ---- Base ---- + +// command +export const configCommand = interopDefault(_configCommand); + +// JSDoc export const pluginJsdoc = interopDefault( _pluginJsdoc, ) as unknown as ESLint.Plugin; -export const pluginJsonc = interopDefault( - _pluginJsonc, -) as unknown as ESLint.Plugin; -export const pluginMarkdown = interopDefault( - _pluginMarkdown, -) as unknown as ESLint.Plugin; -export const pluginN = interopDefault(_pluginN) as unknown as ESLint.Plugin; -export const pluginPackageJson = interopDefault( - _pluginPackageJson, + +// imports +export const pluginImportX = interopDefault( + _pluginImportX, ) as unknown as ESLint.Plugin; -export const pluginPerfectionist = interopDefault( - _pluginPerfectionist, + +// unused imports +export const pluginUnusedImports = interopDefault(_pluginUnusedImports); + +// Promise +export const pluginPromise = interopDefault( + _pluginPromise, ) as unknown as ESLint.Plugin; + +// RegExp export const pluginRegexp = interopDefault( _pluginRegexp, ) as unknown as ESLint.Plugin; -export const pluginTypeScript = interopDefault( - _pluginTypeScript, + +// Node +export const pluginN = interopDefault(_pluginN) as unknown as ESLint.Plugin; + +// perfectionist +export const pluginPerfectionist = interopDefault( + _pluginPerfectionist, ) as unknown as ESLint.Plugin; + +// unicorn export const pluginUnicorn = interopDefault( _pluginUnicorn, ) as unknown as ESLint.Plugin; -export const pluginUnocss = interopDefault( - _pluginUnocss, -) as unknown as ESLint.Plugin; -export const pluginVue = interopDefault(_pluginVue) as unknown as ESLint.Plugin; -export const pluginVueScopedCss = interopDefault( - _pluginVueScopedCss, -) as unknown as ESLint.Plugin; -export const pluginNuxt2 = interopDefault( - _pluginNuxt2, -) as unknown as ESLint.Plugin; -export const pluginNuxt3 = interopDefault( - _pluginNuxt3, -) as unknown as ESLint.Plugin; -export const pluginPromise = interopDefault( - _pluginPromise, -) as unknown as ESLint.Plugin; + +// ---- Frameworks ---- + +// React export const pluginReactX = interopDefault( _pluginReactX, ) as unknown as ESLint.Plugin; @@ -121,24 +161,66 @@ export const pluginReactPerf = fixupPluginRules( export const pluginReactRefresh = interopDefault( _pluginReactRefresh, ) as unknown as ESLint.Plugin; + +// React Native // https://github.com/Intellicode/eslint-plugin-react-native/issues/333 export const pluginReactNative = fixupPluginRules( // eslint-disable-next-line @typescript-eslint/no-unsafe-argument interopDefault(_pluginReactNative), ) as unknown as ESLint.Plugin; + +// Next export const pluginNext = interopDefault( _pluginNext, ) as unknown as ESLint.Plugin; + +// Vue +export const parserVue = interopDefault(_parserVue); +export const pluginVue = interopDefault(_pluginVue) as unknown as ESLint.Plugin; +export const pluginVueScopedCss = interopDefault( + _pluginVueScopedCss, +) as unknown as ESLint.Plugin; + +// Nuxt +export const pluginNuxt2 = interopDefault( + _pluginNuxt2, +) as unknown as ESLint.Plugin; +export const pluginNuxt3 = interopDefault( + _pluginNuxt3, +) as unknown as ESLint.Plugin; + +// TailwindCSS export const pluginTailwindcss = interopDefault( _pluginTailwindcss, ) as unknown as ESLint.Plugin; -export const pluginToml = interopDefault( - _pluginToml, + +// UnoCSS +export const pluginUnocss = interopDefault( + _pluginUnocss, ) as unknown as ESLint.Plugin; -export const pluginYml = interopDefault(_pluginYml) as unknown as ESLint.Plugin; -export const parserBabel = interopDefault(_parserBabel); + +// ---- Special File Type ---- + +// Markdown +export const pluginMarkdown = interopDefault( + _pluginMarkdown, +) as unknown as ESLint.Plugin; + +// JSONC export const parserJsonc = interopDefault(_parserJsonc); +export const pluginJsonc = interopDefault( + _pluginJsonc, +) as unknown as ESLint.Plugin; +export const pluginPackageJson = interopDefault( + _pluginPackageJson, +) as unknown as ESLint.Plugin; + +// TOML export const parserToml = interopDefault(_parserToml); -export const parserTypeScript = interopDefault(_parserTypeScript); -export const parserVue = interopDefault(_parserVue); +export const pluginToml = interopDefault( + _pluginToml, +) as unknown as ESLint.Plugin; + +// YML export const parserYml = interopDefault(_parserYml); +export const pluginYml = interopDefault(_pluginYml) as unknown as ESLint.Plugin; diff --git a/src/eslint/types.ts b/src/eslint/types.ts index 4a24bc56..7261d236 100644 --- a/src/eslint/types.ts +++ b/src/eslint/types.ts @@ -9,74 +9,107 @@ export type Plugin = ESLint.Plugin; export type Rules = Config["rules"]; -export type CommandOptions = ESLintPluginCommandOptions; +// ---- Ignores ---- +// gitignore export type GitignoreOptions = FlatGitignoreOptions; + +// ignores export interface IgnoresOptions { ignores?: string[]; } -export interface ImportsOptions { + +// ---- Languages ---- + +// JavaScript +export interface JavaScriptOptions { files?: string[]; rules?: Rules; - typescriptFiles?: string[]; - typescriptRules?: Rules; + parserOptions?: Linter.ParserOptions; + languageOptions?: Linter.LanguageOptions; } -export interface JavaScriptOptions { + +// TypeScript +export interface TypeScriptOptions { files?: string[]; rules?: Rules; parserOptions?: Linter.ParserOptions; languageOptions?: Linter.LanguageOptions; + typeCheck?: boolean; } + +// ---- Base ---- + +// command +export type CommandOptions = ESLintPluginCommandOptions; + +// JSDoc export interface JsdocOptions { files?: string[]; rules?: Rules; typescriptFiles?: string[]; typescriptRules?: Rules; } -export interface JsoncOptions { + +// imports +export interface ImportsOptions { files?: string[]; rules?: Rules; + typescriptFiles?: string[]; + typescriptRules?: Rules; } -export interface MarkdownOptions { - markdownFiles?: string[]; - markdownInnerFiles?: string[]; - rules?: Rules; -} -export interface NextOptions { + +// unused imports +export interface UnusedImportsOptions { files?: string[]; rules?: Rules; typescriptFiles?: string[]; typescriptRules?: Rules; } -export interface NodeOptions { + +// Promise +export interface PromiseOptions { files?: string[]; rules?: Rules; typescriptFiles?: string[]; typescriptRules?: Rules; } -export interface NuxtOptions { + +// RegExp +export interface RegExpOptions { files?: string[]; rules?: Rules; + typescriptFiles?: string[]; typescriptRules?: Rules; } -export interface PerfectionistOptions { + +// Node +export interface NodeOptions { files?: string[]; rules?: Rules; typescriptFiles?: string[]; typescriptRules?: Rules; } -export interface PromiseOptions { + +// perfectionist +export interface PerfectionistOptions { files?: string[]; rules?: Rules; typescriptFiles?: string[]; typescriptRules?: Rules; } -export interface ReactNativeOptions { + +// unicorn +export interface UnicornOptions { files?: string[]; rules?: Rules; typescriptFiles?: string[]; typescriptRules?: Rules; } + +// ---- Frameworks ---- + +// React export interface ReactOptions { files?: string[]; rules?: Rules; @@ -89,184 +122,275 @@ export interface ReactOptions { typeCheck?: boolean; settings?: ESLintReactSettings; } -export interface RegExpOptions { + +// React Native +export interface ReactNativeOptions { files?: string[]; rules?: Rules; typescriptFiles?: string[]; typescriptRules?: Rules; } -export interface TailwindCssOptions { + +// Next +export interface NextOptions { files?: string[]; rules?: Rules; typescriptFiles?: string[]; typescriptRules?: Rules; } -export interface TomlOptions { + +// Vue +export interface VueOptions { files?: string[]; rules?: Rules; + typescriptRules?: Rules; } -export interface TypeScriptOptions { + +// Nuxt +export interface NuxtOptions { files?: string[]; rules?: Rules; - parserOptions?: Linter.ParserOptions; - languageOptions?: Linter.LanguageOptions; - typeCheck?: boolean; + typescriptRules?: Rules; } -export interface UnicornOptions { + +// TailwindCSS +export interface TailwindCssOptions { files?: string[]; rules?: Rules; typescriptFiles?: string[]; typescriptRules?: Rules; } + +// UnoCSS export interface UnoCssOptions { files?: string[]; rules?: Rules; typescriptFiles?: string[]; typescriptRules?: Rules; } -export interface VueOptions { + +// ---- Special File Type ---- + +// markdown +export interface MarkdownOptions { + markdownFiles?: string[]; + markdownInnerFiles?: string[]; + rules?: Rules; +} + +// JSONC +export interface JsoncOptions { + files?: string[]; + rules?: Rules; +} + +// TOML +export interface TomlOptions { files?: string[]; rules?: Rules; - typescriptRules?: Rules; } + +// YML export interface YmlOptions { files?: string[]; rules?: Rules; } export interface Options { - /** - * Based on eslint-plugin-command. - * - * @default true - */ - command?: CommandOptions | boolean; + // ---- Ignores ---- + + // gitignore /** * Based on eslint-config-flat-gitignore. Use gitignore and eslintignore. * * @default true */ gitignore?: GitignoreOptions | boolean; + + // ignores /** * Use preset exclude. * * @default true */ ignores?: IgnoresOptions | boolean; + + // ---- Languages ---- + + // JavaScript /** - * Detect import issues. + * Detect JavaScript issues. * * @default true */ - imports?: ImportsOptions | boolean; + javascript?: JavaScriptOptions | boolean; + /** - * Detect JavaScript issues. + * Detect TypeScript issues. + * + * Enabled by default if you have TypeScript installed. + */ + typescript?: TypeScriptOptions | boolean; + + // ---- Base ---- + + // command + /** + * Based on eslint-plugin-command. * * @default true */ - javascript?: JavaScriptOptions | boolean; + command?: CommandOptions | boolean; + + // JSDoc /** * Detect JSDoc issues. * * @default false */ jsdoc?: JsdocOptions | boolean; + + // imports /** - * Detect jsonc issues. + * Detect import issues. * * @default true */ - jsonc?: JsoncOptions | boolean; + imports?: ImportsOptions | boolean; + + // unused imports /** - * Detect markdown issues. + * Detect unused import issues. * * @default true */ - markdown?: MarkdownOptions | boolean; + unusedImports?: UnusedImportsOptions | boolean; + + // Promise /** - * Detect next issues. + * Detect promise issues. * - * Enabled by default if you have next installed. + * @default true */ - next?: NextOptions | boolean; + promise?: PromiseOptions | boolean; + + // RegExp /** - * Detect node issues. + * Detect regexp issues. * * @default true */ - node?: NodeOptions | boolean; + regexp?: RegExpOptions | boolean; + + // Node /** - * Detect nuxt issues. + * Detect node issues. * - * Enabled by default if you have nuxt installed. + * @default true */ - nuxt?: NuxtOptions | boolean; + node?: NodeOptions | boolean; + + // perfectionist /** * Based on eslint-plugin-perfectionist. * * @default true */ perfectionist?: PerfectionistOptions | boolean; + + // unicorn /** - * Detect promise issues. + * Based on eslint-plugin-unicorn. * * @default true */ - promise?: PromiseOptions | boolean; + unicorn?: UnicornOptions | boolean; + + // ---- Frameworks ---- + + // React /** * Detect react issues. * * Enabled by default if you have react installed. */ react?: ReactOptions | boolean; + + // React Native /** * Detect react-native issues. * * Enabled by default if you have react-native installed. */ reactNative?: ReactNativeOptions | boolean; + + // Next /** - * Detect regexp issues. + * Detect next issues. * - * @default true + * Enabled by default if you have next installed. */ - regexp?: RegExpOptions | boolean; + next?: NextOptions | boolean; + + // Vue /** - * Detect tailwindcss issues. + * Detect vue issues. * - * Enabled by default if you have tailwindcss installed. + * Enabled by default if you have vue installed. */ - tailwindcss?: TailwindCssOptions | boolean; + vue?: VueOptions | boolean; + + // Nuxt /** - * Detect toml issues. + * Detect nuxt issues. * - * @default true + * Enabled by default if you have nuxt installed. */ - toml?: TomlOptions | boolean; + nuxt?: NuxtOptions | boolean; + + // TailwindCSS /** - * Detect TypeScript issues. + * Detect tailwindcss issues. * - * Enabled by default if you have TypeScript installed. + * Enabled by default if you have tailwindcss installed. */ - typescript?: TypeScriptOptions | boolean; + tailwindcss?: TailwindCssOptions | boolean; + + // UnoCSS /** - * Based on eslint-plugin-unicorn. + * Detect unocss issues. + * + * Enabled by default if you have unocss installed. + */ + unocss?: UnoCssOptions | boolean; + + // ---- Special File Type ---- + + // Markdown + /** + * Detect markdown issues. * * @default true */ - unicorn?: UnicornOptions | boolean; + markdown?: MarkdownOptions | boolean; + + // JSONC /** - * Detect unocss issues. + * Detect jsonc issues. * - * Enabled by default if you have unocss installed. + * @default true */ - unocss?: UnoCssOptions | boolean; + jsonc?: JsoncOptions | boolean; + + // TOML /** - * Detect vue issues. + * Detect toml issues. * - * Enabled by default if you have vue installed. + * @default true */ - vue?: VueOptions | boolean; + toml?: TomlOptions | boolean; + + // YML /** * Detect yml issues. * diff --git a/src/eslint/utils.ts b/src/eslint/utils.ts index ca499534..4a92535f 100644 --- a/src/eslint/utils.ts +++ b/src/eslint/utils.ts @@ -12,28 +12,29 @@ import type { Options, Config } from "./types.ts"; export function parseOptions(options: Options = {}): Required { return { - command: options.command ?? true, gitignore: options.gitignore ?? true, ignores: options.ignores ?? true, - imports: options.imports ?? true, javascript: options.javascript ?? true, + typescript: options.typescript ?? hasTypeScript, + command: options.command ?? true, jsdoc: options.jsdoc ?? false, - jsonc: options.jsonc ?? true, - markdown: options.markdown ?? true, - next: options.next ?? hasNext, + imports: options.imports ?? true, + unusedImports: options.unusedImports ?? true, + promise: options.promise ?? true, + regexp: options.regexp ?? true, node: options.node ?? true, - nuxt: options.nuxt ?? hasNuxt, perfectionist: options.perfectionist ?? true, - promise: options.promise ?? true, + unicorn: options.unicorn ?? true, react: options.react ?? hasReact, reactNative: options.reactNative ?? hasReactNative, - regexp: options.regexp ?? true, + next: options.next ?? hasNext, + vue: options.vue ?? hasVue, + nuxt: options.nuxt ?? hasNuxt, tailwindcss: options.tailwindcss ?? hasTailwindCss, - toml: options.toml ?? true, - typescript: options.typescript ?? hasTypeScript, - unicorn: options.unicorn ?? true, unocss: options.unocss ?? hasUnoCss, - vue: options.vue ?? hasVue, + markdown: options.markdown ?? true, + jsonc: options.jsonc ?? true, + toml: options.toml ?? true, yml: options.yml ?? true, }; }