Compare commits
4 Commits
flat
...
97eb90f6c6
Author | SHA1 | Date | |
---|---|---|---|
97eb90f6c6 | |||
a1ab2ad7f5 | |||
511652dd48 | |||
553965243f |
23
dist/config/index.d.ts
vendored
23
dist/config/index.d.ts
vendored
@ -26,18 +26,21 @@ export type Middleware =
|
||||
* 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 function extendConfig(
|
||||
options:
|
||||
| FlatESLintConfig[]
|
||||
| {
|
||||
auto?: boolean;
|
||||
middlewares?: Middleware[];
|
||||
configs: FlatESLintConfig[];
|
||||
/**
|
||||
* Use `.gitignore` file to exclude files from ESLint.
|
||||
*/
|
||||
gitignore?: boolean;
|
||||
},
|
||||
): Promise<FlatESLintConfig[]>;
|
||||
|
||||
export const error = 'error';
|
||||
export const warn = 'warn';
|
||||
|
37
dist/package.json
vendored
37
dist/package.json
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@aet/eslint-rules",
|
||||
"version": "2.0.1-beta.8",
|
||||
"version": "2.0.6",
|
||||
"license": "UNLICENSED",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
@ -9,47 +9,46 @@
|
||||
},
|
||||
"main": "./config/index.js",
|
||||
"peerDependencies": {
|
||||
"eslint": "^9.12.0",
|
||||
"typescript": "^5.4.4"
|
||||
"eslint": "^9.14.0",
|
||||
"typescript": "^5.6.3"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@tanstack/eslint-plugin-query": "^5.52.0"
|
||||
"@tanstack/eslint-plugin-query": "^5.59.7"
|
||||
},
|
||||
"dependencies": {
|
||||
"@antfu/install-pkg": "^0.4.1",
|
||||
"@nolyfill/is-core-module": "^1.0.39",
|
||||
"@aet/eslint-define-config": "^0.1.0-beta.28",
|
||||
"@eslint/js": "^9.12.0",
|
||||
"@eslint-community/eslint-utils": "^4.4.0",
|
||||
"@aet/eslint-define-config": "^0.1.0-beta.33",
|
||||
"@eslint/js": "^9.14.0",
|
||||
"@eslint-community/eslint-utils": "^4.4.1",
|
||||
"@types/eslint": "^9.6.1",
|
||||
"@typescript-eslint/eslint-plugin": "^8.10.0",
|
||||
"@typescript-eslint/parser": "^8.10.0",
|
||||
"@eslint-react/eslint-plugin": "1.15.0",
|
||||
"@stylistic/eslint-plugin": "^2.9.0",
|
||||
"@typescript-eslint/type-utils": "^8.10.0",
|
||||
"@typescript-eslint/utils": "^8.10.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.13.0",
|
||||
"@typescript-eslint/parser": "^8.13.0",
|
||||
"@eslint-react/eslint-plugin": "1.15.2",
|
||||
"@stylistic/eslint-plugin": "^2.10.1",
|
||||
"@typescript-eslint/type-utils": "^8.13.0",
|
||||
"@typescript-eslint/utils": "^8.13.0",
|
||||
"aria-query": "^5.3.2",
|
||||
"axe-core": "^4.10.1",
|
||||
"axe-core": "^4.10.2",
|
||||
"axobject-query": "4.1.0",
|
||||
"damerau-levenshtein": "1.0.8",
|
||||
"debug": "^4.3.7",
|
||||
"doctrine": "^3.0.0",
|
||||
"emoji-regex": "^10.4.0",
|
||||
"enhanced-resolve": "^5.17.1",
|
||||
"typescript-eslint": "^8.10.0",
|
||||
"typescript-eslint": "^8.13.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-import-resolver-node": "^0.3.9",
|
||||
"eslint-import-resolver-typescript": "^3.6.3",
|
||||
"eslint-module-utils": "^2.12.0",
|
||||
"eslint-plugin-es-x": "^8.0.0",
|
||||
"eslint-plugin-import-x": "^4.3.1",
|
||||
"eslint-plugin-import-x": "^4.4.0",
|
||||
"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.8.1",
|
||||
"globals": "^15.11.0",
|
||||
"globals": "^15.12.0",
|
||||
"ignore": "^6.0.2",
|
||||
"is-bun-module": "^1.2.1",
|
||||
"is-glob": "^4.0.3",
|
||||
@ -72,4 +71,4 @@
|
||||
"**/is-core-module": "file:./overrides/is-core-module",
|
||||
"**/supports-preserve-symlinks-flag": "file:./overrides/supports-preserve-symlinks-flag"
|
||||
}
|
||||
}
|
||||
}
|
2267
dist/pnpm-lock.yaml
generated
vendored
2267
dist/pnpm-lock.yaml
generated
vendored
File diff suppressed because it is too large
Load Diff
44
package.json
44
package.json
@ -1,6 +1,7 @@
|
||||
{
|
||||
"name": "@aet/eslint-configs",
|
||||
"type": "module",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"build": "./scripts/build.ts",
|
||||
"check-import": "./scripts/check-imports.ts",
|
||||
@ -9,20 +10,21 @@
|
||||
},
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@aet/eslint-define-config": "^0.1.0-beta.29",
|
||||
"@aet/eslint-define-config": "^0.1.0-beta.33",
|
||||
"@antfu/install-pkg": "^0.4.1",
|
||||
"@babel/core": "^7.25.8",
|
||||
"@babel/plugin-transform-flow-strip-types": "^7.25.7",
|
||||
"@babel/preset-env": "^7.25.8",
|
||||
"@eslint-react/eslint-plugin": "^1.15.0",
|
||||
"@eslint/js": "^9.13.0",
|
||||
"@babel/core": "^7.26.0",
|
||||
"@babel/plugin-transform-flow-strip-types": "^7.25.9",
|
||||
"@babel/preset-env": "^7.26.0",
|
||||
"@eslint-react/eslint-plugin": "^1.15.2",
|
||||
"@eslint/js": "^9.14.0",
|
||||
"@graphql-eslint/eslint-plugin": "^3.20.1",
|
||||
"@stylistic/eslint-plugin": "^2.9.0",
|
||||
"@stylistic/eslint-plugin": "^2.10.1",
|
||||
"@swc-node/register": "^1.10.9",
|
||||
"@tanstack/eslint-plugin-query": "^5.59.7",
|
||||
"@tanstack/eslint-plugin-query": "^5.60.1",
|
||||
"@types/babel-plugin-macros": "^3.1.3",
|
||||
"@types/babel__core": "^7.20.5",
|
||||
"@types/eslint": "^9.6.1",
|
||||
"@types/eslint-config-prettier": "^6.11.3",
|
||||
"@types/eslint-plugin-tailwindcss": "^3.17.0",
|
||||
"@types/eslint__js": "^8.42.3",
|
||||
"@types/esprima": "^4.0.6",
|
||||
@ -30,24 +32,24 @@
|
||||
"@types/estree": "^1.0.6",
|
||||
"@types/estree-jsx": "^1.0.5",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/node": "^22.7.7",
|
||||
"@types/node": "^22.9.0",
|
||||
"@types/react-refresh": "^0.14.6",
|
||||
"@typescript-eslint/eslint-plugin": "^8.10.0",
|
||||
"@typescript-eslint/parser": "^8.10.0",
|
||||
"@typescript-eslint/type-utils": "^8.10.0",
|
||||
"@typescript-eslint/types": "^8.10.0",
|
||||
"@typescript-eslint/typescript-estree": "^8.10.0",
|
||||
"@typescript-eslint/utils": "^8.10.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.13.0",
|
||||
"@typescript-eslint/parser": "^8.13.0",
|
||||
"@typescript-eslint/type-utils": "^8.13.0",
|
||||
"@typescript-eslint/types": "^8.13.0",
|
||||
"@typescript-eslint/typescript-estree": "^8.13.0",
|
||||
"@typescript-eslint/utils": "^8.13.0",
|
||||
"babel-plugin-macros": "^3.1.0",
|
||||
"dts-bundle-generator": "9.5.1",
|
||||
"esbuild": "0.24.0",
|
||||
"esbuild-plugin-alias": "^0.2.1",
|
||||
"eslint": "9.13.0",
|
||||
"eslint": "9.14.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.3",
|
||||
"eslint-plugin-import-x": "^4.3.1",
|
||||
"eslint-plugin-import-x": "^4.4.0",
|
||||
"eslint-plugin-jsdoc": "^50.4.3",
|
||||
"eslint-plugin-react-refresh": "^0.4.12",
|
||||
"eslint-plugin-react-refresh": "^0.4.14",
|
||||
"eslint-plugin-storybook": "canary",
|
||||
"eslint-plugin-testing-library": "^6.4.0",
|
||||
"eslint-plugin-unicorn": "^56.0.0",
|
||||
@ -56,11 +58,11 @@
|
||||
"esquery": "^1.6.0",
|
||||
"fast-glob": "^3.3.2",
|
||||
"find-cache-dir": "^5.0.0",
|
||||
"globals": "^15.11.0",
|
||||
"globals": "^15.12.0",
|
||||
"graphql": "^16.9.0",
|
||||
"json-schema-to-ts": "^3.1.1",
|
||||
"lodash-es": "^4.17.21",
|
||||
"nolyfill": "^1.0.41",
|
||||
"nolyfill": "^1.0.42",
|
||||
"patch-package": "^8.0.0",
|
||||
"picocolors": "^1.1.1",
|
||||
"prettier": "^3.3.3",
|
||||
@ -68,7 +70,7 @@
|
||||
"terser": "^5.36.0",
|
||||
"type-fest": "^4.26.1",
|
||||
"typescript": "^5.6.3",
|
||||
"typescript-eslint": "^8.10.0"
|
||||
"typescript-eslint": "^8.13.0"
|
||||
},
|
||||
"prettier": {
|
||||
"arrowParens": "avoid",
|
||||
|
@ -205,8 +205,21 @@ index df7b6b8..c4d0da1 100644
|
||||
nodeName: 'input',
|
||||
attributes: {
|
||||
autocomplete,
|
||||
diff --git a/src/rules/label-has-associated-control.js b/src/rules/label-has-associated-control.js
|
||||
index dd6b199..184199e 100644
|
||||
--- a/src/rules/label-has-associated-control.js
|
||||
+++ b/src/rules/label-has-associated-control.js
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
import { hasProp, getProp, getPropValue } from 'jsx-ast-utils';
|
||||
import type { JSXElement } from 'ast-types-flow';
|
||||
-import minimatch from 'minimatch';
|
||||
+import { minimatch } from 'minimatch';
|
||||
import { generateObjSchema, arraySchema } from '../util/schemas';
|
||||
import type { ESLintConfig, ESLintContext, ESLintVisitorSelectorConfig } from '../../flow/eslint';
|
||||
import getElementType from '../util/getElementType';
|
||||
diff --git a/src/util/mayContainChildComponent.js b/src/util/mayContainChildComponent.js
|
||||
index 43a03ef..5e1035e 100644
|
||||
index 65000a0..09b199a 100644
|
||||
--- a/src/util/mayContainChildComponent.js
|
||||
+++ b/src/util/mayContainChildComponent.js
|
||||
@@ -9,7 +9,7 @@
|
||||
|
@ -1,8 +1,8 @@
|
||||
diff --git a/lib/index.js b/lib/index.js
|
||||
index 49fd4c7..a0fdd81 100644
|
||||
index de95218..e30a3df 100644
|
||||
--- a/lib/index.js
|
||||
+++ b/lib/index.js
|
||||
@@ -1,9 +1,9 @@
|
||||
@@ -1,17 +1,17 @@
|
||||
"use strict"
|
||||
|
||||
-const pkg = require("../package.json")
|
||||
@ -14,18 +14,17 @@ index 49fd4c7..a0fdd81 100644
|
||||
+import cjsConfig from "./configs/recommended-script"
|
||||
+import recommendedConfig from "./configs/recommended"
|
||||
|
||||
/**
|
||||
* @typedef {{
|
||||
@@ -20,8 +20,8 @@ const recommendedConfig = require("./configs/recommended")
|
||||
/** @type {import('eslint').ESLint.Plugin & { configs: Configs }} */
|
||||
const plugin = {
|
||||
/** @import { ESLint, Linter } from 'eslint' */
|
||||
|
||||
/** @type {ESLint.Plugin} */
|
||||
const base = {
|
||||
meta: {
|
||||
- name: pkg.name,
|
||||
- version: pkg.version,
|
||||
+ name,
|
||||
+ version,
|
||||
},
|
||||
rules: /** @type {Record<string, import('eslint').Rule.RuleModule>} */ ({
|
||||
rules: {
|
||||
"callback-return": require("./rules/callback-return"),
|
||||
diff --git a/tests/fixtures/no-extraneous/dependencies/node_modules/@bbb/aaa.js b/tests/fixtures/no-extraneous/dependencies/node_modules/@bbb/aaa.js
|
||||
deleted file mode 100644
|
||||
|
1840
pnpm-lock.yaml
generated
1840
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -6,22 +6,22 @@
|
||||
"subject": "[meta] add `repository.directory` field"
|
||||
},
|
||||
"eslint-import-resolver-typescript": {
|
||||
"hash": "5ee5879b4428f42edbc262d66e192c76202b7f47",
|
||||
"date": "2024-10-01T03:12:28+00:00",
|
||||
"hash": "42e7cc3eb413dda56683c1b2b2483e4756e0bd62",
|
||||
"date": "2024-11-01T01:52:08+00:00",
|
||||
"committer": "GitHub",
|
||||
"subject": "fix(deps): update dependency debug to ^4.3.7 (#316)"
|
||||
"subject": "chore(deps): update dependency @types/node to ^18.19.63 (#320)"
|
||||
},
|
||||
"eslint-plugin-jsx-a11y": {
|
||||
"hash": "4925ba8d0bf80a4b1d8e8645d310590bf1b40b64",
|
||||
"date": "2024-09-20T14:09:27-07:00",
|
||||
"hash": "743168b1ba15196ec7001c7c1f368f5efbe78f0d",
|
||||
"date": "2024-10-23T13:27:41+10:00",
|
||||
"committer": "Jordan Harband",
|
||||
"subject": "[Fix] handle interactive/noninteractive changes from aria-query"
|
||||
"subject": "[New] `label-has-associated-control`: allow `labelComponents` to contain globs"
|
||||
},
|
||||
"eslint-plugin-n": {
|
||||
"hash": "23d0e846e9dbfb68ccf7f410a83457514d432263",
|
||||
"date": "2024-10-09T13:49:20+02:00",
|
||||
"hash": "c4d15512b24a8c7c3ba4bf8b598e66eafd1baeec",
|
||||
"date": "2024-11-07T20:14:17+08:00",
|
||||
"committer": "GitHub",
|
||||
"subject": "chore(master): release 17.11.1 (#352)"
|
||||
"subject": "chore(master): release 17.13.1 (#381)"
|
||||
},
|
||||
"eslint-plugin-react": {
|
||||
"hash": "983b88dd3cb5e07919517d3fde4085f60883ded7",
|
||||
|
23
src/config.d.ts
vendored
23
src/config.d.ts
vendored
@ -26,18 +26,21 @@ export type Middleware =
|
||||
* 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 function extendConfig(
|
||||
options:
|
||||
| FlatESLintConfig[]
|
||||
| {
|
||||
auto?: boolean;
|
||||
middlewares?: Middleware[];
|
||||
configs: FlatESLintConfig[];
|
||||
/**
|
||||
* Use `.gitignore` file to exclude files from ESLint.
|
||||
*/
|
||||
gitignore?: boolean;
|
||||
},
|
||||
): Promise<FlatESLintConfig[]>;
|
||||
|
||||
export const error = 'error';
|
||||
export const warn = 'warn';
|
||||
|
48
src/index.ts
48
src/index.ts
@ -1,5 +1,8 @@
|
||||
import fs from 'node:fs';
|
||||
|
||||
import type { FlatESLintConfig } from '@aet/eslint-define-config';
|
||||
import * as tsParser from '@typescript-eslint/parser';
|
||||
import prettier from 'eslint-config-prettier';
|
||||
import importPlugin from 'eslint-plugin-import-x';
|
||||
import { uniq } from 'lodash-es';
|
||||
import tseslint from 'typescript-eslint';
|
||||
@ -14,15 +17,23 @@ import unicorn from './presets/unicorn';
|
||||
|
||||
export { error, warn, off } from './constants';
|
||||
|
||||
export async function extendConfig({
|
||||
auto = true,
|
||||
middlewares: addMiddlewares = [],
|
||||
configs = [],
|
||||
}: {
|
||||
auto?: boolean;
|
||||
middlewares?: Middleware[];
|
||||
configs: FlatESLintConfig[];
|
||||
}): Promise<FlatESLintConfig[]> {
|
||||
export async function extendConfig(
|
||||
options:
|
||||
| FlatESLintConfig[]
|
||||
| {
|
||||
auto?: boolean;
|
||||
middlewares?: Middleware[];
|
||||
configs: FlatESLintConfig[];
|
||||
gitignore?: boolean;
|
||||
} = [],
|
||||
): Promise<FlatESLintConfig[]> {
|
||||
const {
|
||||
auto = true,
|
||||
middlewares: addMiddlewares = [],
|
||||
configs = [],
|
||||
gitignore = true,
|
||||
} = Array.isArray(options) ? { configs: options } : options;
|
||||
|
||||
const middlewares: Middleware[] = uniq([
|
||||
() => import('./presets/custom'),
|
||||
...(auto ? checkEnv() : []),
|
||||
@ -41,8 +52,8 @@ export async function extendConfig({
|
||||
...unicorn,
|
||||
stylistic,
|
||||
{
|
||||
name: 'eslint-rules: TypeScript and import-x',
|
||||
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
|
||||
name: 'eslint-rules/typescript-and-import-x',
|
||||
files: ['**/*.{js,mjs,cjs,jsx,ts,tsx,mts,cts}'],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
parser: tsParser,
|
||||
@ -81,7 +92,7 @@ export async function extendConfig({
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'eslint-rules: .d.ts files',
|
||||
name: 'eslint-rules/.d.ts-files',
|
||||
files: ['*.d.ts'],
|
||||
rules: {
|
||||
'@typescript-eslint/consistent-type-imports': off,
|
||||
@ -106,5 +117,18 @@ export async function extendConfig({
|
||||
result.push(...configs);
|
||||
}
|
||||
|
||||
result.push(prettier);
|
||||
|
||||
if (gitignore && fs.existsSync('.gitignore')) {
|
||||
const ignores = fs
|
||||
.readFileSync('.gitignore', 'utf8')
|
||||
.trim()
|
||||
.split('\n')
|
||||
.map(line => line.trim())
|
||||
.filter(line => line && !line.startsWith('#'));
|
||||
|
||||
result.push({ ignores });
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -26,6 +26,14 @@ export async function react() {
|
||||
files: ['*.tsx'],
|
||||
rules: reactRules,
|
||||
},
|
||||
{
|
||||
name: 'eslint-rules/react/test-files',
|
||||
files: ['*.test.tsx'],
|
||||
rules: {
|
||||
'@eslint-react/no-clone-element': off,
|
||||
'@eslint-react/no-create-ref': off,
|
||||
},
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,7 @@ const stylisticRules: Partial<StylisticRulesObject> = {
|
||||
'stylistic/spaced-comment': [
|
||||
error,
|
||||
'always',
|
||||
// allow /*@__PURE__*/
|
||||
{ markers: ['/', '#', '@'], block: { exceptions: ['@'] } },
|
||||
{ block: { exceptions: ['@__PURE__', '#__PURE__'] } },
|
||||
],
|
||||
'stylistic/jsx-sort-props': [
|
||||
error,
|
||||
|
@ -13,5 +13,11 @@ export default defineConfig([
|
||||
{
|
||||
name: 'eslint-rules/tailwind',
|
||||
rules: tailwindRules,
|
||||
settings: {
|
||||
tailwindcss: {
|
||||
callees: ['classnames', 'clsx', 'tw', 'twx'],
|
||||
classRegex: '^(css|class(Name)?)$',
|
||||
},
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
@ -37,10 +37,7 @@ export const typescriptRules: Partial<TypeScriptRulesObject> = {
|
||||
warn,
|
||||
{ accessibility: 'no-public' },
|
||||
],
|
||||
'@typescript-eslint/no-empty-object-type': [
|
||||
error,
|
||||
{ allowInterfaces: 'with-single-extends' },
|
||||
],
|
||||
'@typescript-eslint/no-empty-object-type': off,
|
||||
'@typescript-eslint/no-empty-interface': [error, { allowSingleExtends: true }],
|
||||
'@typescript-eslint/no-explicit-any': off,
|
||||
'@typescript-eslint/no-misused-promises': [error, { checksVoidReturn: false }],
|
||||
|
Reference in New Issue
Block a user