Upgrade to ESLint 9
This commit is contained in:
44
dist/config/index.d.ts
vendored
Normal file
44
dist/config/index.d.ts
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
import type { FlatESLintConfig } from '@aet/eslint-define-config';
|
||||
import type { Linter } from 'eslint';
|
||||
|
||||
type MiddlewareResult = Linter.Config | Linter.Config[];
|
||||
|
||||
export type Middleware =
|
||||
| (() => Promise<MiddlewareResult>)
|
||||
| (() => Promise<{ default: MiddlewareResult }>);
|
||||
|
||||
/**
|
||||
* Returns a ESLint config object.
|
||||
*
|
||||
* By default, it includes `["@typescript-eslint", "import-x", "prettier", "unicorn"]` configs.
|
||||
* Additional bundled plugins include:
|
||||
*
|
||||
* 1. [`react`](https://github.com/jsx-eslint/eslint-plugin-react#list-of-supported-rules)
|
||||
* (automatically enables
|
||||
* [`react-hooks`](https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks))
|
||||
* 2. [`react-refresh`](https://github.com/ArnaudBarre/eslint-plugin-react-refresh)
|
||||
* 3. [`jsx-a11y`](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y#supported-rules)
|
||||
* 4. [`unicorn`](https://github.com/sindresorhus/eslint-plugin-unicorn#rules)
|
||||
* 5. [`n`](https://github.com/eslint-community/eslint-plugin-n#-rules) (Node.js specific,
|
||||
* requires `minimatch`)
|
||||
* 6. [`jsdoc`](https://github.com/gajus/eslint-plugin-jsdoc#rules)
|
||||
*
|
||||
* Non bundled:
|
||||
* 1. [`graphql`](https://the-guild.dev/graphql/eslint/rules)
|
||||
*
|
||||
* @param of Configuration options.
|
||||
* @returns ESLint configuration object.
|
||||
*/
|
||||
export function extendConfig({
|
||||
auto,
|
||||
middlewares: addMiddlewares,
|
||||
configs,
|
||||
}: {
|
||||
auto?: boolean;
|
||||
middlewares?: Middleware[];
|
||||
configs: FlatESLintConfig[];
|
||||
}): Promise<FlatESLintConfig[]>;
|
||||
|
||||
export const error = 'error';
|
||||
export const warn = 'warn';
|
||||
export const off = 'off';
|
8
dist/eslint-plugin-jsx-a11y/index.d.ts
vendored
8
dist/eslint-plugin-jsx-a11y/index.d.ts
vendored
@ -1,8 +0,0 @@
|
||||
import type { Linter } from 'eslint';
|
||||
|
||||
export const rules: Readonly<Linter.RulesRecord>;
|
||||
|
||||
export const configs: {
|
||||
recommended: Linter.BaseConfig;
|
||||
strict: Linter.BaseConfig;
|
||||
};
|
12
dist/eslint-plugin-react-hooks/index.d.ts
vendored
12
dist/eslint-plugin-react-hooks/index.d.ts
vendored
@ -1,12 +0,0 @@
|
||||
import type { Linter, Rule } from 'eslint';
|
||||
|
||||
export const __EXPERIMENTAL__: false;
|
||||
|
||||
export const configs: {
|
||||
recommended: Linter.BaseConfig;
|
||||
};
|
||||
|
||||
export const rules: {
|
||||
'rules-of-hooks': Rule.RuleModule;
|
||||
'exhaustive-deps': Rule.RuleModule;
|
||||
};
|
87
dist/index.d.ts
vendored
87
dist/index.d.ts
vendored
@ -1,81 +1,12 @@
|
||||
// Generated by dts-bundle-generator v9.4.0
|
||||
|
||||
import { ESLintConfig, KnownExtends, Rules, Settings } from '@aet/eslint-define-config';
|
||||
import { ESLintUtils } from '@typescript-eslint/utils';
|
||||
import { Rule } from 'eslint';
|
||||
import { Merge, SetRequired } from 'type-fest';
|
||||
import { FlatESLintConfig } from '@aet/eslint-define-config';
|
||||
import { Linter } from 'eslint';
|
||||
|
||||
export type OptionalObjectKey<T> = Exclude<{
|
||||
[Key in keyof T]: undefined | any[] extends T[Key] ? Key : undefined | Record<any, any> extends T[Key] ? Key : never;
|
||||
}[keyof T], undefined>;
|
||||
export type MiddlewareConfig = Merge<SetRequired<ESLintConfig, OptionalObjectKey<ESLintConfig>>, {
|
||||
extends: KnownExtends[];
|
||||
}>;
|
||||
export interface MiddlewareFunctions {
|
||||
addRules(rules: Partial<RuleOptions>): void;
|
||||
addSettings(settings: Partial<Settings>): void;
|
||||
}
|
||||
export type Middleware = (config: MiddlewareConfig, helpers: MiddlewareFunctions) => void;
|
||||
export declare const graphql: Middleware;
|
||||
export declare const jsdoc: Middleware;
|
||||
export declare const storybook: Middleware;
|
||||
export declare const react: Middleware;
|
||||
export declare const reactRefresh: Middleware;
|
||||
export declare const tailwind: Middleware;
|
||||
export declare const error = "error";
|
||||
export declare const warn = "warn";
|
||||
export declare const off = "off";
|
||||
export type RuleLevel = "error" | "warn" | "off" | 0 | 1 | 2;
|
||||
export type RuleEntry<Options> = RuleLevel | [
|
||||
RuleLevel,
|
||||
Partial<Options>
|
||||
];
|
||||
export interface LocalRuleOptions {
|
||||
/** Bans import from the specifier '.' and '..' and replaces it with '.+/index' */
|
||||
"custom/no-import-dot": RuleEntry<unknown>;
|
||||
/**
|
||||
* Enforce template literal expressions to be of `string` type
|
||||
* @see [restrict-template-expressions](https://typescript-eslint.io/rules/restrict-template-expressions)
|
||||
*/
|
||||
"custom/restrict-template-expressions": RuleEntry<{
|
||||
allow: string[];
|
||||
}>;
|
||||
/** Ban assignment of empty object literals `{}` and replace them with `Object.create(null)` */
|
||||
"custom/no-empty-object-literal": RuleEntry<unknown>;
|
||||
/** Ban useless import alias */
|
||||
"custom/no-useless-import-alias": RuleEntry<unknown>;
|
||||
}
|
||||
export type RuleOptions = Rules & Partial<LocalRuleOptions>;
|
||||
export interface CustomRule {
|
||||
rule: () => Promise<{
|
||||
default: Rule.RuleModule | ESLintUtils.RuleModule<string, unknown[]>;
|
||||
}>;
|
||||
options?: RuleLevel;
|
||||
}
|
||||
/**
|
||||
* ESLint Configuration.
|
||||
* @see [ESLint Configuration](https://eslint.org/docs/latest/user-guide/configuring/)
|
||||
*/
|
||||
export type InputConfig = Omit<ESLintConfig, "rules"> & {
|
||||
/**
|
||||
* Rules.
|
||||
* @see [Rules](https://eslint.org/docs/latest/user-guide/configuring/rules)
|
||||
*/
|
||||
rules?: Partial<RuleOptions>;
|
||||
/**
|
||||
* Glob pattern to find paths to custom rule files in JavaScript or TypeScript.
|
||||
* Note this must be a string literal or an array of string literals since
|
||||
* this is statically analyzed.
|
||||
*
|
||||
* Rules are prefixed with `custom/` and the file name is used as the rule name.
|
||||
*/
|
||||
customRuleFiles?: string | string[];
|
||||
/**
|
||||
* Automatically detect project types, dependencies and deduct the plugins.
|
||||
* @default true
|
||||
*/
|
||||
auto?: boolean;
|
||||
};
|
||||
export type MiddlewareResult = Linter.Config | Linter.Config[];
|
||||
export type Middleware = (() => Promise<MiddlewareResult>) | (() => Promise<{
|
||||
default: MiddlewareResult;
|
||||
}>);
|
||||
/**
|
||||
* Returns a ESLint config object.
|
||||
*
|
||||
@ -98,8 +29,10 @@ export type InputConfig = Omit<ESLintConfig, "rules"> & {
|
||||
* @param of Configuration options.
|
||||
* @returns ESLint configuration object.
|
||||
*/
|
||||
export declare function extendConfig(of?: InputConfig & {
|
||||
export declare function extendConfig({ auto, middlewares: addMiddlewares, configs, }: {
|
||||
auto?: boolean;
|
||||
middlewares?: Middleware[];
|
||||
}): ESLintConfig;
|
||||
configs: FlatESLintConfig[];
|
||||
}): Promise<FlatESLintConfig[]>;
|
||||
|
||||
export {};
|
||||
|
50
dist/package.json
vendored
50
dist/package.json
vendored
@ -1,56 +1,58 @@
|
||||
{
|
||||
"name": "@aet/eslint-rules",
|
||||
"version": "1.0.1-beta.42",
|
||||
"version": "2.0.1-beta.1",
|
||||
"license": "UNLICENSED",
|
||||
"bin": {
|
||||
"eslint-install": "install.js",
|
||||
"eslint-print": "print-config.sh"
|
||||
},
|
||||
"main": "./config/index.js",
|
||||
"peerDependencies": {
|
||||
"eslint": "^8.57.0",
|
||||
"eslint": "^9.12.0",
|
||||
"typescript": "^5.4.4"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@tanstack/eslint-plugin-query": "^5.52.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@antfu/install-pkg": "^0.4.0",
|
||||
"@antfu/install-pkg": "^0.4.1",
|
||||
"@nolyfill/is-core-module": "^1.0.39",
|
||||
"@aet/eslint-define-config": "^0.1.0-beta.24",
|
||||
"@aet/eslint-define-config": "^0.1.0-beta.28",
|
||||
"@eslint/js": "^9.12.0",
|
||||
"@eslint-community/eslint-utils": "^4.4.0",
|
||||
"@types/eslint": "^9.6.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.2.0",
|
||||
"@typescript-eslint/parser": "^8.2.0",
|
||||
"@typescript-eslint/type-utils": "^8.2.0",
|
||||
"@typescript-eslint/utils": "^8.2.0",
|
||||
"@eslint-react/eslint-plugin": "1.12.1",
|
||||
"@stylistic/eslint-plugin": "^2.6.4",
|
||||
"aria-query": "^5.3.0",
|
||||
"@types/eslint": "^9.6.1",
|
||||
"@typescript-eslint/eslint-plugin": "^8.9.0",
|
||||
"@typescript-eslint/parser": "^8.9.0",
|
||||
"@eslint-react/eslint-plugin": "1.15.0",
|
||||
"@stylistic/eslint-plugin": "^2.9.0",
|
||||
"@typescript-eslint/type-utils": "^8.9.0",
|
||||
"@typescript-eslint/utils": "^8.9.0",
|
||||
"aria-query": "^5.3.2",
|
||||
"axe-core": "^4.10.0",
|
||||
"axobject-query": "4.1.0",
|
||||
"damerau-levenshtein": "1.0.8",
|
||||
"debug": "^4.3.6",
|
||||
"debug": "^4.3.7",
|
||||
"doctrine": "^3.0.0",
|
||||
"emoji-regex": "^10.3.0",
|
||||
"emoji-regex": "^10.4.0",
|
||||
"enhanced-resolve": "^5.17.1",
|
||||
"typescript-eslint": "^8.9.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-import-resolver-node": "^0.3.9",
|
||||
"eslint-module-utils": "^2.8.1",
|
||||
"eslint-module-utils": "^2.12.0",
|
||||
"eslint-plugin-es-x": "^8.0.0",
|
||||
"eslint-plugin-import-x": "^3.1.0",
|
||||
"eslint-plugin-jsdoc": "^50.2.2",
|
||||
"eslint-plugin-react-refresh": "^0.4.11",
|
||||
"eslint-plugin-unicorn": "^55.0.0",
|
||||
"eslint-plugin-import-x": "^4.3.1",
|
||||
"eslint-plugin-unicorn": "^56.0.0",
|
||||
"esprima": "^4.0.1",
|
||||
"esquery": "^1.6.0",
|
||||
"estraverse": "^5.3.0",
|
||||
"fast-glob": "^3.3.2",
|
||||
"get-tsconfig": "^4.7.6",
|
||||
"is-bun-module": "^1.1.0",
|
||||
"ignore": "^5.3.2",
|
||||
"get-tsconfig": "^4.8.1",
|
||||
"globals": "^15.11.0",
|
||||
"ignore": "^6.0.2",
|
||||
"is-bun-module": "^1.2.1",
|
||||
"is-glob": "^4.0.3",
|
||||
"language-tags": "^1.0.9",
|
||||
"lodash": "^4.17.21",
|
||||
"lodash-es": "^4.17.21",
|
||||
"minimatch": "^10.0.1",
|
||||
"semver": "^7.6.3"
|
||||
},
|
||||
@ -68,4 +70,4 @@
|
||||
"**/is-core-module": "file:./overrides/is-core-module",
|
||||
"**/supports-preserve-symlinks-flag": "file:./overrides/supports-preserve-symlinks-flag"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
2
dist/print-config.sh
vendored
Normal file → Executable file
2
dist/print-config.sh
vendored
Normal file → Executable file
@ -1,2 +1,2 @@
|
||||
#!/bin/bash
|
||||
node -e "console.dir(require('./.eslintrc.js'), { depth: null })"
|
||||
node -e "import('./eslint.config.mjs').then(config => console.dir(config, { depth: null }))"
|
||||
|
Reference in New Issue
Block a user