Bump
This commit is contained in:
parent
3ac5f91988
commit
ba20685f2e
@ -4,7 +4,7 @@ Personal ESLint config. Guaranteed to have no useless polyfills.
|
||||
|
||||
## flat config support
|
||||
|
||||
- ⏱️ [a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/pull/993)
|
||||
- ⏱️ [a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/978)
|
||||
- ✅ [react](https://github.com/jsx-eslint/eslint-plugin-react/pull/3429)
|
||||
- ✅ [unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn/pull/1886)
|
||||
- ❌ [import](https://github.com/un-ts/eslint-plugin-import-x/issues/29)
|
||||
|
9
dist/eslint-plugin-react/index.d.ts
vendored
9
dist/eslint-plugin-react/index.d.ts
vendored
@ -1,9 +0,0 @@
|
||||
import type { Linter } from 'eslint';
|
||||
|
||||
export const deprecatedRules: Readonly<Linter.RulesRecord>;
|
||||
|
||||
export const configs: {
|
||||
recommended: Linter.BaseConfig;
|
||||
all: Linter.BaseConfig;
|
||||
'jsx-runtime': Linter.BaseConfig;
|
||||
};
|
39
dist/package.json
vendored
39
dist/package.json
vendored
@ -1,24 +1,27 @@
|
||||
{
|
||||
"name": "@aet/eslint-rules",
|
||||
"version": "1.0.1-beta.11",
|
||||
"version": "1.0.1-beta.13",
|
||||
"license": "UNLICENSED",
|
||||
"bin": {
|
||||
"eslint-install": "./install.js"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": "^8.57.0",
|
||||
"typescript": "^5.4.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nolyfill/is-core-module": "^1.0.39",
|
||||
"@aet/eslint-define-config": "^0.1.0-beta.15",
|
||||
"@aet/eslint-define-config": "^0.1.0-beta.16",
|
||||
"@eslint-community/eslint-utils": "^4.4.0",
|
||||
"@tanstack/eslint-plugin-query": "^5.51.15",
|
||||
"@types/eslint": "^8.56.11",
|
||||
"@typescript-eslint/eslint-plugin": "^7.17.0",
|
||||
"@typescript-eslint/parser": "^7.17.0",
|
||||
"@typescript-eslint/type-utils": "^7.17.0",
|
||||
"@typescript-eslint/utils": "^7.17.0",
|
||||
"@eslint-react/eslint-plugin": "^1.6.0",
|
||||
"@types/eslint": "^9.6.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
||||
"@typescript-eslint/parser": "^8.0.0",
|
||||
"@typescript-eslint/type-utils": "^8.0.0",
|
||||
"@typescript-eslint/utils": "^8.0.0",
|
||||
"@eslint-react/eslint-plugin": "^1.8.0",
|
||||
"aria-query": "^5.3.0",
|
||||
"axe-core": "^4.9.1",
|
||||
"axe-core": "^4.10.0",
|
||||
"axobject-query": "4.1.0",
|
||||
"damerau-levenshtein": "1.0.8",
|
||||
"debug": "^4.3.6",
|
||||
@ -30,7 +33,7 @@
|
||||
"eslint-module-utils": "^2.8.1",
|
||||
"eslint-plugin-es-x": "^8.0.0",
|
||||
"eslint-plugin-import-x": "^3.1.0",
|
||||
"eslint-plugin-jsdoc": "^48.8.3",
|
||||
"eslint-plugin-jsdoc": "^48.11.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.9",
|
||||
"eslint-plugin-unicorn": "^55.0.0",
|
||||
"esprima": "^4.0.1",
|
||||
@ -43,9 +46,15 @@
|
||||
"is-glob": "^4.0.3",
|
||||
"language-tags": "^1.0.9",
|
||||
"lodash": "^4.17.21",
|
||||
"resolve": "^2.0.0-next.5",
|
||||
"minimatch": "^10.0.1",
|
||||
"semver": "^7.6.3"
|
||||
},
|
||||
"pnpm": {
|
||||
"overrides": {
|
||||
"is-core-module": "file:./overrides/is-core-module",
|
||||
"supports-preserve-symlinks-flag": "file:./overrides/supports-preserve-symlinks-flag"
|
||||
}
|
||||
},
|
||||
"overrides": {
|
||||
"is-core-module": "file:./overrides/is-core-module",
|
||||
"supports-preserve-symlinks-flag": "file:./overrides/supports-preserve-symlinks-flag"
|
||||
@ -53,11 +62,5 @@
|
||||
"resolutions": {
|
||||
"**/is-core-module": "file:./overrides/is-core-module",
|
||||
"**/supports-preserve-symlinks-flag": "file:./overrides/supports-preserve-symlinks-flag"
|
||||
},
|
||||
"pnpm": {
|
||||
"overrides": {
|
||||
"is-core-module": "file:./overrides/is-core-module",
|
||||
"supports-preserve-symlinks-flag": "file:./overrides/supports-preserve-symlinks-flag"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
2
dist/types.d.ts
vendored
2
dist/types.d.ts
vendored
@ -6,7 +6,7 @@ import { Rule } from 'eslint';
|
||||
export declare function defineRules(rules: {
|
||||
[ruleName: string]: Rule.RuleModule | ESLintUtils.RuleModule<string, unknown[]>;
|
||||
}): {
|
||||
[ruleName: string]: Rule.RuleModule | ESLintUtils.RuleModule<string, unknown[], ESLintUtils.RuleListener>;
|
||||
[ruleName: string]: Rule.RuleModule | ESLintUtils.RuleModule<string, unknown[], unknown, ESLintUtils.RuleListener>;
|
||||
};
|
||||
export declare function defineRule({ name, create, ...meta }: Rule.RuleMetaData & {
|
||||
name?: string;
|
||||
|
28
package.json
28
package.json
@ -3,14 +3,16 @@
|
||||
"scripts": {
|
||||
"build": "./scripts/build.ts",
|
||||
"check-import": "./scripts/check-imports.ts",
|
||||
"define": "/usr/local/bin/codium ./packages/eslint-define-config"
|
||||
"define": "/usr/local/bin/codium ./packages/eslint-define-config",
|
||||
"do": "yarn build; (cd dist && ver bump && npm publish)"
|
||||
},
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@aet/eslint-define-config": "^0.1.0-beta.15",
|
||||
"@babel/core": "^7.24.9",
|
||||
"@babel/plugin-transform-flow-strip-types": "^7.24.7",
|
||||
"@babel/preset-env": "^7.25.0",
|
||||
"@aet/eslint-define-config": "^0.1.0-beta.16",
|
||||
"@antfu/install-pkg": "^0.3.3",
|
||||
"@babel/core": "^7.25.2",
|
||||
"@babel/plugin-transform-flow-strip-types": "^7.25.2",
|
||||
"@babel/preset-env": "^7.25.3",
|
||||
"@types/babel-plugin-macros": "^3.1.3",
|
||||
"@types/babel__core": "^7.20.5",
|
||||
"@types/eslint": "^9.6.0",
|
||||
@ -19,12 +21,12 @@
|
||||
"@types/estree": "^1.0.5",
|
||||
"@types/estree-jsx": "^1.0.5",
|
||||
"@types/lodash": "^4.17.7",
|
||||
"@types/node": "^20.14.12",
|
||||
"@typescript-eslint/eslint-plugin": "7.17.0",
|
||||
"@typescript-eslint/type-utils": "^7.17.0",
|
||||
"@typescript-eslint/types": "^7.17.0",
|
||||
"@typescript-eslint/typescript-estree": "^7.17.0",
|
||||
"@typescript-eslint/utils": "^7.17.0",
|
||||
"@types/node": "^22.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
||||
"@typescript-eslint/type-utils": "^8.0.0",
|
||||
"@typescript-eslint/types": "^8.0.0",
|
||||
"@typescript-eslint/typescript-estree": "^8.0.0",
|
||||
"@typescript-eslint/utils": "^8.0.0",
|
||||
"babel-plugin-macros": "^3.1.0",
|
||||
"dts-bundle-generator": "9.4.0",
|
||||
"esbuild": "0.23.0",
|
||||
@ -64,9 +66,9 @@
|
||||
"jsonify": "npm:@nolyfill/jsonify@^1",
|
||||
"object-keys": "npm:@nolyfill/object-keys@^1",
|
||||
"set-function-length": "npm:@nolyfill/set-function-length@^1",
|
||||
"@babel/types": "7.24.0",
|
||||
"@babel/types": "7.25.2",
|
||||
"is-core-module": "npm:@nolyfill/is-core-module@^1",
|
||||
"json-stable-stringify": "npm:@nolyfill/json-stable-stringify@^1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
1603
pnpm-lock.yaml
generated
1603
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -71,6 +71,7 @@ function bundle(
|
||||
.replace('./packages/', './dist/')
|
||||
.replace('src/', '')
|
||||
.replace('.ts', '.js'),
|
||||
options?: esbuild.BuildOptions,
|
||||
) {
|
||||
return esbuild.build({
|
||||
entryPoints: [entry],
|
||||
@ -87,6 +88,7 @@ function bundle(
|
||||
banner: {
|
||||
js: '/* eslint-disable */',
|
||||
},
|
||||
...options,
|
||||
});
|
||||
}
|
||||
|
||||
@ -143,6 +145,7 @@ async function main() {
|
||||
bundle('./src/index.ts', './dist/index.js'),
|
||||
bundle('./src/types.ts', './dist/types.js'),
|
||||
bundle('./src/prettier.ts', './dist/prettier.js'),
|
||||
bundle('./src/install.ts', './dist/install.js', { minify: false }),
|
||||
editPackageJson(),
|
||||
]);
|
||||
|
||||
|
@ -3,12 +3,10 @@ import glob from 'fast-glob';
|
||||
import fs from 'fs';
|
||||
import { builtinModules } from 'module';
|
||||
import { uniq } from 'lodash';
|
||||
import { dependencies, peerDependencies, overrides } from '../dist/package.json';
|
||||
import { dependencies, peerDependencies } from '../dist/package.json';
|
||||
|
||||
function checkImports() {
|
||||
const deps = Object.keys({ ...dependencies, ...peerDependencies, ...overrides }).concat(
|
||||
'eslint',
|
||||
);
|
||||
const deps = Object.keys({ ...dependencies, ...peerDependencies }).concat('eslint');
|
||||
const builtIn = new Set(builtinModules.flatMap(module => [module, `node:${module}`]));
|
||||
|
||||
function findRequires(text: string) {
|
||||
|
@ -6,10 +6,10 @@
|
||||
"subject": "[meta] add `repository.directory` field"
|
||||
},
|
||||
"eslint-import-resolver-typescript": {
|
||||
"hash": "c9b5626ee69bd529c7e391e40928a4fb28dce179",
|
||||
"date": "2024-07-23T20:40:14+08:00",
|
||||
"hash": "3dfad602a05b4b3812a4d3fc681051932f86e838",
|
||||
"date": "2024-08-01T01:15:59+00:00",
|
||||
"committer": "GitHub",
|
||||
"subject": "chore: release eslint-import-resolver-typescript (#302)"
|
||||
"subject": "chore(deps): update dependency node to v18.20.4 (#309)"
|
||||
},
|
||||
"eslint-plugin-jsx-a11y": {
|
||||
"hash": "cca288b73a39fa0932a57c02a7a88de68fc971fc",
|
||||
|
63
src/env.ts
63
src/env.ts
@ -4,8 +4,45 @@ import { Middleware, storybook } from './index';
|
||||
import { react, reactRefresh } from './presets/react';
|
||||
import { tailwind } from './presets/tailwind';
|
||||
import { reactQuery } from './presets/misc';
|
||||
import { testingLibrary } from './presets/testing-library';
|
||||
|
||||
export function* checkEnv(): Generator<Middleware> {
|
||||
export const envs: {
|
||||
dependency: string;
|
||||
eslintPlugin?: string;
|
||||
middleware: Middleware;
|
||||
}[] = [
|
||||
{
|
||||
dependency: 'react',
|
||||
middleware: react,
|
||||
},
|
||||
{
|
||||
dependency: '@vitejs/plugin-react',
|
||||
eslintPlugin: 'eslint-plugin-react-refresh',
|
||||
middleware: reactRefresh,
|
||||
},
|
||||
{
|
||||
dependency: 'tailwindcss',
|
||||
eslintPlugin: 'eslint-plugin-tailwindcss',
|
||||
middleware: tailwind,
|
||||
},
|
||||
{
|
||||
dependency: 'storybook',
|
||||
eslintPlugin: 'eslint-plugin-storybook',
|
||||
middleware: storybook,
|
||||
},
|
||||
{
|
||||
dependency: '@tanstack/react-query',
|
||||
eslintPlugin: '@tanstack/eslint-plugin-query',
|
||||
middleware: reactQuery,
|
||||
},
|
||||
{
|
||||
dependency: '@testing-library/react',
|
||||
eslintPlugin: 'eslint-plugin-testing-library',
|
||||
middleware: testingLibrary,
|
||||
},
|
||||
];
|
||||
|
||||
export function getProjectDependencies() {
|
||||
const rootDir = process.cwd();
|
||||
|
||||
const pkgJsonPath = resolve(rootDir, 'package.json');
|
||||
@ -13,27 +50,21 @@ export function* checkEnv(): Generator<Middleware> {
|
||||
? JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8'))
|
||||
: {};
|
||||
|
||||
const deps = new Set(
|
||||
return new Set(
|
||||
Object.keys({
|
||||
...pkgJson.dependencies,
|
||||
...pkgJson.devDependencies,
|
||||
...pkgJson.peerDependencies,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
if (deps.has('react')) {
|
||||
yield react;
|
||||
}
|
||||
if (deps.has('@vitejs/plugin-react') && deps.has('eslint-plugin-react-refresh')) {
|
||||
yield reactRefresh;
|
||||
}
|
||||
if (deps.has('tailwindcss') && deps.has('eslint-plugin-tailwindcss')) {
|
||||
yield tailwind;
|
||||
}
|
||||
if (deps.has('storybook') && deps.has('eslint-plugin-storybook')) {
|
||||
yield storybook;
|
||||
}
|
||||
if (deps.has('@tanstack/react-query') && deps.has('@tanstack/eslint-plugin-query')) {
|
||||
yield reactQuery;
|
||||
export function* checkEnv(): Generator<Middleware> {
|
||||
const deps = getProjectDependencies();
|
||||
|
||||
for (const { dependency, eslintPlugin, middleware } of envs) {
|
||||
if (deps.has(dependency) && (!eslintPlugin || deps.has(eslintPlugin))) {
|
||||
yield middleware;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
20
src/install.ts
Normal file
20
src/install.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { installPackage } from '@antfu/install-pkg';
|
||||
import { uniq } from 'lodash';
|
||||
import { getProjectDependencies, envs } from './env';
|
||||
|
||||
const deps = getProjectDependencies();
|
||||
const packages = uniq(
|
||||
envs
|
||||
.filter(_ => deps.has(_.dependency) && _.eslintPlugin && !deps.has(_.eslintPlugin))
|
||||
.map(_ => _.eslintPlugin!),
|
||||
);
|
||||
|
||||
console.log('Installing missing ESLint plugins:');
|
||||
for (const pkg of packages) {
|
||||
console.log(`- ${pkg}`);
|
||||
}
|
||||
console.log();
|
||||
|
||||
void installPackage(packages, {
|
||||
silent: false,
|
||||
});
|
12
src/presets/testing-library.ts
Normal file
12
src/presets/testing-library.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import type { Middleware } from '../index';
|
||||
import { TestingLibraryRulesObject } from '@aet/eslint-define-config/src/rules/testing-library';
|
||||
|
||||
const testingLibraryRules: Partial<TestingLibraryRulesObject> = {};
|
||||
|
||||
export const testingLibrary: Middleware = (config, { addRules }) => {
|
||||
config.overrides.push({
|
||||
files: ['**/*.(spec|test).{ts,tsx}'],
|
||||
plugins: ['plugin:testing-library/react'],
|
||||
});
|
||||
addRules(testingLibraryRules);
|
||||
};
|
@ -19,7 +19,6 @@ const typescriptRules: Partial<TypeScriptRulesObject> = {
|
||||
'ts-nocheck': 'allow-with-description',
|
||||
},
|
||||
],
|
||||
'@typescript-eslint/ban-types': [error, { extendDefaults: true }],
|
||||
'@typescript-eslint/consistent-type-imports': [
|
||||
error,
|
||||
{ disallowTypeAnnotations: false, fixStyle: 'inline-type-imports' },
|
||||
|
Loading…
x
Reference in New Issue
Block a user