Update
This commit is contained in:
parent
00d0dfa107
commit
eb366f3b2e
38
dist/index.d.ts
vendored
38
dist/index.d.ts
vendored
@ -1,38 +0,0 @@
|
|||||||
// Generated by dts-bundle-generator v9.4.0
|
|
||||||
|
|
||||||
import { FlatESLintConfig } from '@aet/eslint-define-config';
|
|
||||||
import { Linter } from 'eslint';
|
|
||||||
|
|
||||||
export 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 declare function extendConfig({ auto, middlewares: addMiddlewares, configs, }: {
|
|
||||||
auto?: boolean;
|
|
||||||
middlewares?: Middleware[];
|
|
||||||
configs: FlatESLintConfig[];
|
|
||||||
}): Promise<FlatESLintConfig[]>;
|
|
||||||
|
|
||||||
export {};
|
|
16
dist/package.json
vendored
16
dist/package.json
vendored
@ -1,7 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "@aet/eslint-rules",
|
"name": "@aet/eslint-rules",
|
||||||
"version": "2.0.1-beta.1",
|
"version": "2.0.1-beta.8",
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
|
"type": "module",
|
||||||
"bin": {
|
"bin": {
|
||||||
"eslint-install": "install.js",
|
"eslint-install": "install.js",
|
||||||
"eslint-print": "print-config.sh"
|
"eslint-print": "print-config.sh"
|
||||||
@ -21,23 +22,24 @@
|
|||||||
"@eslint/js": "^9.12.0",
|
"@eslint/js": "^9.12.0",
|
||||||
"@eslint-community/eslint-utils": "^4.4.0",
|
"@eslint-community/eslint-utils": "^4.4.0",
|
||||||
"@types/eslint": "^9.6.1",
|
"@types/eslint": "^9.6.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.9.0",
|
"@typescript-eslint/eslint-plugin": "^8.10.0",
|
||||||
"@typescript-eslint/parser": "^8.9.0",
|
"@typescript-eslint/parser": "^8.10.0",
|
||||||
"@eslint-react/eslint-plugin": "1.15.0",
|
"@eslint-react/eslint-plugin": "1.15.0",
|
||||||
"@stylistic/eslint-plugin": "^2.9.0",
|
"@stylistic/eslint-plugin": "^2.9.0",
|
||||||
"@typescript-eslint/type-utils": "^8.9.0",
|
"@typescript-eslint/type-utils": "^8.10.0",
|
||||||
"@typescript-eslint/utils": "^8.9.0",
|
"@typescript-eslint/utils": "^8.10.0",
|
||||||
"aria-query": "^5.3.2",
|
"aria-query": "^5.3.2",
|
||||||
"axe-core": "^4.10.0",
|
"axe-core": "^4.10.1",
|
||||||
"axobject-query": "4.1.0",
|
"axobject-query": "4.1.0",
|
||||||
"damerau-levenshtein": "1.0.8",
|
"damerau-levenshtein": "1.0.8",
|
||||||
"debug": "^4.3.7",
|
"debug": "^4.3.7",
|
||||||
"doctrine": "^3.0.0",
|
"doctrine": "^3.0.0",
|
||||||
"emoji-regex": "^10.4.0",
|
"emoji-regex": "^10.4.0",
|
||||||
"enhanced-resolve": "^5.17.1",
|
"enhanced-resolve": "^5.17.1",
|
||||||
"typescript-eslint": "^8.9.0",
|
"typescript-eslint": "^8.10.0",
|
||||||
"eslint-config-prettier": "^9.1.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"eslint-import-resolver-node": "^0.3.9",
|
"eslint-import-resolver-node": "^0.3.9",
|
||||||
|
"eslint-import-resolver-typescript": "^3.6.3",
|
||||||
"eslint-module-utils": "^2.12.0",
|
"eslint-module-utils": "^2.12.0",
|
||||||
"eslint-plugin-es-x": "^8.0.0",
|
"eslint-plugin-es-x": "^8.0.0",
|
||||||
"eslint-plugin-import-x": "^4.3.1",
|
"eslint-plugin-import-x": "^4.3.1",
|
||||||
|
2267
dist/pnpm-lock.yaml
generated
vendored
Normal file
2267
dist/pnpm-lock.yaml
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
37
package.json
37
package.json
@ -9,13 +9,13 @@
|
|||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@aet/eslint-define-config": "^0.1.0-beta.28",
|
"@aet/eslint-define-config": "^0.1.0-beta.29",
|
||||||
"@antfu/install-pkg": "^0.4.1",
|
"@antfu/install-pkg": "^0.4.1",
|
||||||
"@babel/core": "^7.25.8",
|
"@babel/core": "^7.25.8",
|
||||||
"@babel/plugin-transform-flow-strip-types": "^7.25.2",
|
"@babel/plugin-transform-flow-strip-types": "^7.25.7",
|
||||||
"@babel/preset-env": "^7.25.8",
|
"@babel/preset-env": "^7.25.8",
|
||||||
"@eslint-react/eslint-plugin": "^1.15.0",
|
"@eslint-react/eslint-plugin": "^1.15.0",
|
||||||
"@eslint/js": "^9.12.0",
|
"@eslint/js": "^9.13.0",
|
||||||
"@graphql-eslint/eslint-plugin": "^3.20.1",
|
"@graphql-eslint/eslint-plugin": "^3.20.1",
|
||||||
"@stylistic/eslint-plugin": "^2.9.0",
|
"@stylistic/eslint-plugin": "^2.9.0",
|
||||||
"@swc-node/register": "^1.10.9",
|
"@swc-node/register": "^1.10.9",
|
||||||
@ -30,26 +30,26 @@
|
|||||||
"@types/estree": "^1.0.6",
|
"@types/estree": "^1.0.6",
|
||||||
"@types/estree-jsx": "^1.0.5",
|
"@types/estree-jsx": "^1.0.5",
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@types/node": "^22.7.5",
|
"@types/node": "^22.7.7",
|
||||||
"@types/react-refresh": "^0.14.6",
|
"@types/react-refresh": "^0.14.6",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.9.0",
|
"@typescript-eslint/eslint-plugin": "^8.10.0",
|
||||||
"@typescript-eslint/parser": "^8.9.0",
|
"@typescript-eslint/parser": "^8.10.0",
|
||||||
"@typescript-eslint/type-utils": "^8.9.0",
|
"@typescript-eslint/type-utils": "^8.10.0",
|
||||||
"@typescript-eslint/types": "^8.9.0",
|
"@typescript-eslint/types": "^8.10.0",
|
||||||
"@typescript-eslint/typescript-estree": "^8.9.0",
|
"@typescript-eslint/typescript-estree": "^8.10.0",
|
||||||
"@typescript-eslint/utils": "^8.9.0",
|
"@typescript-eslint/utils": "^8.10.0",
|
||||||
"babel-plugin-macros": "^3.1.0",
|
"babel-plugin-macros": "^3.1.0",
|
||||||
"dts-bundle-generator": "9.4.0",
|
"dts-bundle-generator": "9.5.1",
|
||||||
"esbuild": "0.24.0",
|
"esbuild": "0.24.0",
|
||||||
"esbuild-plugin-alias": "^0.2.1",
|
"esbuild-plugin-alias": "^0.2.1",
|
||||||
"eslint": "9.12.0",
|
"eslint": "9.13.0",
|
||||||
"eslint-config-prettier": "^9.1.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"eslint-import-resolver-typescript": "^3.6.3",
|
"eslint-import-resolver-typescript": "^3.6.3",
|
||||||
"eslint-plugin-import-x": "^4.3.1",
|
"eslint-plugin-import-x": "^4.3.1",
|
||||||
"eslint-plugin-jsdoc": "^50.4.1",
|
"eslint-plugin-jsdoc": "^50.4.3",
|
||||||
"eslint-plugin-react-refresh": "^0.4.12",
|
"eslint-plugin-react-refresh": "^0.4.12",
|
||||||
"eslint-plugin-storybook": "canary",
|
"eslint-plugin-storybook": "canary",
|
||||||
"eslint-plugin-testing-library": "^6.3.0",
|
"eslint-plugin-testing-library": "^6.4.0",
|
||||||
"eslint-plugin-unicorn": "^56.0.0",
|
"eslint-plugin-unicorn": "^56.0.0",
|
||||||
"eslint-plugin-vitest": "^0.5.4",
|
"eslint-plugin-vitest": "^0.5.4",
|
||||||
"esprima": "^4.0.1",
|
"esprima": "^4.0.1",
|
||||||
@ -58,18 +58,17 @@
|
|||||||
"find-cache-dir": "^5.0.0",
|
"find-cache-dir": "^5.0.0",
|
||||||
"globals": "^15.11.0",
|
"globals": "^15.11.0",
|
||||||
"graphql": "^16.9.0",
|
"graphql": "^16.9.0",
|
||||||
"jiti": "^1.21.6",
|
|
||||||
"json-schema-to-ts": "^3.1.1",
|
"json-schema-to-ts": "^3.1.1",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"nolyfill": "^1.0.39",
|
"nolyfill": "^1.0.41",
|
||||||
"patch-package": "^8.0.0",
|
"patch-package": "^8.0.0",
|
||||||
"picocolors": "^1.1.0",
|
"picocolors": "^1.1.1",
|
||||||
"prettier": "^3.3.3",
|
"prettier": "^3.3.3",
|
||||||
"prop-types": "^15.8.1",
|
"prop-types": "^15.8.1",
|
||||||
"terser": "^5.34.1",
|
"terser": "^5.36.0",
|
||||||
"type-fest": "^4.26.1",
|
"type-fest": "^4.26.1",
|
||||||
"typescript": "^5.6.3",
|
"typescript": "^5.6.3",
|
||||||
"typescript-eslint": "^8.9.0"
|
"typescript-eslint": "^8.10.0"
|
||||||
},
|
},
|
||||||
"prettier": {
|
"prettier": {
|
||||||
"arrowParens": "avoid",
|
"arrowParens": "avoid",
|
||||||
|
630
pnpm-lock.yaml
generated
630
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -87,6 +87,7 @@ async function bundle(
|
|||||||
define: {},
|
define: {},
|
||||||
alias: {},
|
alias: {},
|
||||||
external: ['find-cache-dir'],
|
external: ['find-cache-dir'],
|
||||||
|
format: 'esm',
|
||||||
banner: {
|
banner: {
|
||||||
js: '/* eslint-disable */',
|
js: '/* eslint-disable */',
|
||||||
},
|
},
|
||||||
|
@ -30,7 +30,10 @@ export async function extendConfig({
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
const result: FlatESLintConfig[] = [
|
const result: FlatESLintConfig[] = [
|
||||||
{ rules: eslintRules }, //
|
{
|
||||||
|
name: 'eslint-rules/eslint',
|
||||||
|
rules: eslintRules,
|
||||||
|
},
|
||||||
...tseslint.configs.recommendedTypeChecked,
|
...tseslint.configs.recommendedTypeChecked,
|
||||||
importPlugin.flatConfigs.recommended,
|
importPlugin.flatConfigs.recommended,
|
||||||
importPlugin.flatConfigs.react,
|
importPlugin.flatConfigs.react,
|
||||||
@ -38,6 +41,7 @@ export async function extendConfig({
|
|||||||
...unicorn,
|
...unicorn,
|
||||||
stylistic,
|
stylistic,
|
||||||
{
|
{
|
||||||
|
name: 'eslint-rules: TypeScript and import-x',
|
||||||
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
|
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
@ -65,6 +69,7 @@ export async function extendConfig({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
name: 'eslint-rules: Disable type checking',
|
||||||
files: ['*.js', '*.mjs', '*.cjs', '*.jsx'],
|
files: ['*.js', '*.mjs', '*.cjs', '*.jsx'],
|
||||||
...tseslint.configs.disableTypeChecked,
|
...tseslint.configs.disableTypeChecked,
|
||||||
rules: {
|
rules: {
|
||||||
@ -76,6 +81,7 @@ export async function extendConfig({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
name: 'eslint-rules: .d.ts files',
|
||||||
files: ['*.d.ts'],
|
files: ['*.d.ts'],
|
||||||
rules: {
|
rules: {
|
||||||
'@typescript-eslint/consistent-type-imports': off,
|
'@typescript-eslint/consistent-type-imports': off,
|
||||||
|
6
src/modules.d.ts
vendored
6
src/modules.d.ts
vendored
@ -18,7 +18,13 @@ declare module 'eslint-plugin-storybook' {
|
|||||||
import type { Linter } from 'eslint';
|
import type { Linter } from 'eslint';
|
||||||
|
|
||||||
export const configs: {
|
export const configs: {
|
||||||
|
/** @deprecated */
|
||||||
csf: Linter.Config;
|
csf: Linter.Config;
|
||||||
|
/** @deprecated */
|
||||||
recommended: Linter.Config;
|
recommended: Linter.Config;
|
||||||
|
'flat/csf': Linter.Config;
|
||||||
|
'flat/recommended': Linter.Config;
|
||||||
|
'flat/csf-strict': Linter.Config;
|
||||||
|
'flat/addon-interactions': Linter.Config;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import { defineConfig } from '../types';
|
|||||||
|
|
||||||
export default defineConfig([
|
export default defineConfig([
|
||||||
{
|
{
|
||||||
|
name: 'eslint-rules/custom',
|
||||||
plugins: { custom: plugin },
|
plugins: { custom: plugin },
|
||||||
rules: {
|
rules: {
|
||||||
'custom/no-import-dot': error,
|
'custom/no-import-dot': error,
|
||||||
@ -11,8 +12,10 @@ export default defineConfig([
|
|||||||
} satisfies Partial<LocalRuleOptions>,
|
} satisfies Partial<LocalRuleOptions>,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
name: 'eslint-rules/typed-custom',
|
||||||
plugins: { 'typed-custom': typedPlugin },
|
plugins: { 'typed-custom': typedPlugin },
|
||||||
files: ['*.ts', '!*.d.ts'],
|
files: ['*.ts'],
|
||||||
|
ignores: ['*.d.ts'],
|
||||||
rules: {
|
rules: {
|
||||||
'typed-custom/restrict-template-expressions': error,
|
'typed-custom/restrict-template-expressions': error,
|
||||||
} satisfies Partial<LocalRuleOptions>,
|
} satisfies Partial<LocalRuleOptions>,
|
||||||
|
@ -10,5 +10,5 @@ const jsdocRules: Partial<JSDocRulesObject> = {
|
|||||||
|
|
||||||
export default defineConfig([
|
export default defineConfig([
|
||||||
module.configs['flat/recommended-typescript'],
|
module.configs['flat/recommended-typescript'],
|
||||||
{ rules: jsdocRules },
|
{ name: 'eslint-rules/jsdoc', rules: jsdocRules },
|
||||||
]);
|
]);
|
||||||
|
@ -2,8 +2,8 @@ import { def } from '../middleware';
|
|||||||
import { defineConfig } from '../types';
|
import { defineConfig } from '../types';
|
||||||
|
|
||||||
export async function storybook() {
|
export async function storybook() {
|
||||||
const { configs } = await import('eslint-plugin-storybook');
|
const { configs } = def(await import('eslint-plugin-storybook'));
|
||||||
return defineConfig([configs.recommended]);
|
return defineConfig([configs['flat/recommended']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function reactQuery() {
|
export async function reactQuery() {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import type { ReactRulesObject } from '@aet/eslint-define-config/src/rules/react';
|
import type { ReactRulesObject } from '@aet/eslint-define-config/src/rules/react';
|
||||||
import type { ReactRefreshRulesObject } from '@aet/eslint-define-config/src/rules/react-refresh';
|
import type { ReactRefreshRulesObject } from '@aet/eslint-define-config/src/rules/react-refresh';
|
||||||
|
import type { Linter, ESLint } from 'eslint';
|
||||||
|
|
||||||
import { error, off, warn } from '../constants';
|
import { error, off, warn } from '../constants';
|
||||||
import { def } from '../middleware';
|
import { def } from '../middleware';
|
||||||
@ -17,10 +18,11 @@ export async function react() {
|
|||||||
const hooks = await import('../../packages/eslint-plugin-react-hooks');
|
const hooks = await import('../../packages/eslint-plugin-react-hooks');
|
||||||
|
|
||||||
return defineConfig([
|
return defineConfig([
|
||||||
reactPlugin.configs['recommended-type-checked'] as any,
|
reactPlugin.configs['recommended-type-checked'] as unknown as Linter.Config,
|
||||||
hooks.flatConfigs.recommended,
|
hooks.flatConfigs.recommended,
|
||||||
a11y.flatConfigs.recommended,
|
a11y.flatConfigs.recommended,
|
||||||
{
|
{
|
||||||
|
name: 'eslint-rules/react',
|
||||||
files: ['*.tsx'],
|
files: ['*.tsx'],
|
||||||
rules: reactRules,
|
rules: reactRules,
|
||||||
},
|
},
|
||||||
@ -34,9 +36,9 @@ const refreshRules: Partial<ReactRefreshRulesObject> = {
|
|||||||
export async function reactRefresh() {
|
export async function reactRefresh() {
|
||||||
const refreshPlugin = def(await import('eslint-plugin-react-refresh'));
|
const refreshPlugin = def(await import('eslint-plugin-react-refresh'));
|
||||||
return defineConfig({
|
return defineConfig({
|
||||||
|
name: 'eslint-rules/react-refresh',
|
||||||
plugins: {
|
plugins: {
|
||||||
// @ts-expect-error no types
|
'react-refresh': refreshPlugin as unknown as ESLint.Plugin,
|
||||||
'react-refresh': refreshPlugin,
|
|
||||||
},
|
},
|
||||||
rules: refreshRules,
|
rules: refreshRules,
|
||||||
});
|
});
|
||||||
|
@ -18,6 +18,7 @@ const stylisticRules: Partial<StylisticRulesObject> = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
name: 'eslint-rules/stylistic',
|
||||||
plugins: {
|
plugins: {
|
||||||
stylistic,
|
stylistic,
|
||||||
},
|
},
|
||||||
|
@ -10,5 +10,8 @@ const tailwindRules: Partial<TailwindRulesObject> = {
|
|||||||
|
|
||||||
export default defineConfig([
|
export default defineConfig([
|
||||||
...tailwind.configs['flat/recommended'],
|
...tailwind.configs['flat/recommended'],
|
||||||
{ rules: tailwindRules },
|
{
|
||||||
|
name: 'eslint-rules/tailwind',
|
||||||
|
rules: tailwindRules,
|
||||||
|
},
|
||||||
]);
|
]);
|
||||||
|
@ -6,6 +6,7 @@ import { defineConfig } from '../types';
|
|||||||
const testingLibraryRules: Partial<TestingLibraryRulesObject> = {};
|
const testingLibraryRules: Partial<TestingLibraryRulesObject> = {};
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
name: 'eslint-rules/testing-library',
|
||||||
files: ['**/*.(spec|test).{ts,tsx}'],
|
files: ['**/*.(spec|test).{ts,tsx}'],
|
||||||
...testingLibrary.configs['flat/react'],
|
...testingLibrary.configs['flat/react'],
|
||||||
rules: {
|
rules: {
|
||||||
|
@ -113,6 +113,7 @@ const unicornRules: Partial<UnicornRulesObject> = {
|
|||||||
|
|
||||||
export default defineConfig([
|
export default defineConfig([
|
||||||
{
|
{
|
||||||
|
name: 'eslint-rules/unicorn',
|
||||||
languageOptions: {
|
languageOptions: {
|
||||||
globals: globals.builtin,
|
globals: globals.builtin,
|
||||||
},
|
},
|
||||||
@ -122,6 +123,7 @@ export default defineConfig([
|
|||||||
rules: unicornRules,
|
rules: unicornRules,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
name: 'eslint-rules/unicorn/tests',
|
||||||
files: ['*.test.ts', '*.test.tsx'],
|
files: ['*.test.ts', '*.test.tsx'],
|
||||||
rules: {
|
rules: {
|
||||||
'unicorn/no-useless-undefined': off,
|
'unicorn/no-useless-undefined': off,
|
||||||
|
@ -11,6 +11,10 @@ export function defineConfig(config: Linter.Config): Linter.Config;
|
|||||||
export function defineConfig(config: Linter.Config[]): Linter.Config[];
|
export function defineConfig(config: Linter.Config[]): Linter.Config[];
|
||||||
|
|
||||||
export function defineConfig(config: Linter.Config | Linter.Config[]) {
|
export function defineConfig(config: Linter.Config | Linter.Config[]) {
|
||||||
|
if (!config || (Array.isArray(config) && config.some(c => !c))) {
|
||||||
|
console.trace();
|
||||||
|
throw new Error('Config cannot be empty');
|
||||||
|
}
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user