This commit is contained in:
Alex 2024-03-30 02:06:38 -04:00
parent 19b07691fc
commit 4d2762de39
7 changed files with 1005 additions and 553 deletions

20
dist/package.json vendored
View File

@ -1,6 +1,6 @@
{ {
"name": "@aet/eslint-rules", "name": "@aet/eslint-rules",
"version": "0.0.17", "version": "0.0.18",
"license": "UNLICENSED", "license": "UNLICENSED",
"peerDependencies": { "peerDependencies": {
"eslint": "^8.53.0", "eslint": "^8.53.0",
@ -8,13 +8,13 @@
}, },
"dependencies": { "dependencies": {
"@eslint-community/eslint-utils": "^4.4.0", "@eslint-community/eslint-utils": "^4.4.0",
"@types/eslint": "^8.56.5", "@types/eslint": "^8.56.6",
"@typescript-eslint/eslint-plugin": "^7.2.0", "@typescript-eslint/eslint-plugin": "^7.4.0",
"@typescript-eslint/parser": "^7.2.0", "@typescript-eslint/parser": "^7.4.0",
"@typescript-eslint/type-utils": "^7.2.0", "@typescript-eslint/type-utils": "^7.4.0",
"@typescript-eslint/utils": "^7.2.0", "@typescript-eslint/utils": "^7.4.0",
"aria-query": "^5.3.0", "aria-query": "^5.3.0",
"axe-core": "^4.8.4", "axe-core": "^4.9.0",
"axobject-query": "^4.0.0", "axobject-query": "^4.0.0",
"damerau-levenshtein": "1.0.8", "damerau-levenshtein": "1.0.8",
"debug": "^4.3.4", "debug": "^4.3.4",
@ -25,8 +25,8 @@
"eslint-define-config": "^1.24.1", "eslint-define-config": "^1.24.1",
"eslint-import-resolver-node": "^0.3.9", "eslint-import-resolver-node": "^0.3.9",
"eslint-module-utils": "^2.8.1", "eslint-module-utils": "^2.8.1",
"eslint-plugin-es-x": "^7.5.0", "eslint-plugin-es-x": "^7.6.0",
"eslint-plugin-jsdoc": "^48.2.1", "eslint-plugin-jsdoc": "^48.2.2",
"eslint-plugin-unicorn": "^51.0.1", "eslint-plugin-unicorn": "^51.0.1",
"estraverse": "^5.3.0", "estraverse": "^5.3.0",
"fast-glob": "^3.3.2", "fast-glob": "^3.3.2",
@ -36,7 +36,7 @@
"is-glob": "^4.0.3", "is-glob": "^4.0.3",
"language-tags": "^1.0.9", "language-tags": "^1.0.9",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"minimatch": "^9.0.3", "minimatch": "^9.0.4",
"resolve": "^2.0.0-next.5", "resolve": "^2.0.0-next.5",
"semver": "^7.6.0", "semver": "^7.6.0",
"tsconfig-paths": "^4.2.0" "tsconfig-paths": "^4.2.0"

View File

@ -6,21 +6,21 @@
}, },
"private": true, "private": true,
"devDependencies": { "devDependencies": {
"@babel/core": "^7.24.0", "@babel/core": "^7.24.3",
"@babel/plugin-transform-flow-strip-types": "^7.23.3", "@babel/plugin-transform-flow-strip-types": "^7.24.1",
"@babel/preset-env": "^7.24.0", "@babel/preset-env": "^7.24.3",
"@types/babel-plugin-macros": "^3.1.3", "@types/babel-plugin-macros": "^3.1.3",
"@types/babel__core": "^7.20.5", "@types/babel__core": "^7.20.5",
"@types/eslint": "^8.56.5", "@types/eslint": "^8.56.6",
"@types/estree": "^1.0.5", "@types/estree": "^1.0.5",
"@types/estree-jsx": "^1.0.5", "@types/estree-jsx": "^1.0.5",
"@types/lodash": "^4.17.0", "@types/lodash": "^4.17.0",
"@types/node": "^20.11.27", "@types/node": "^20.12.2",
"@typescript-eslint/eslint-plugin": "7.2.0", "@typescript-eslint/eslint-plugin": "7.4.0",
"@typescript-eslint/type-utils": "^7.2.0", "@typescript-eslint/type-utils": "^7.4.0",
"@typescript-eslint/types": "^7.2.0", "@typescript-eslint/types": "^7.4.0",
"@typescript-eslint/typescript-estree": "^7.2.0", "@typescript-eslint/typescript-estree": "^7.4.0",
"@typescript-eslint/utils": "^7.2.0", "@typescript-eslint/utils": "^7.4.0",
"babel-plugin-macros": "^3.1.0", "babel-plugin-macros": "^3.1.0",
"dts-bundle-generator": "^9.3.1", "dts-bundle-generator": "^9.3.1",
"esbin": "0.0.4", "esbin": "0.0.4",
@ -33,12 +33,12 @@
"find-cache-dir": "^5.0.0", "find-cache-dir": "^5.0.0",
"json-schema-to-ts": "^3.0.1", "json-schema-to-ts": "^3.0.1",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"minimatch": "^9.0.3", "minimatch": "^9.0.4",
"patch-package": "^8.0.0", "patch-package": "^8.0.0",
"picocolors": "^1.0.0", "picocolors": "^1.0.0",
"prettier": "^3.2.5", "prettier": "^3.2.5",
"prop-types": "^15.8.1", "prop-types": "^15.8.1",
"typescript": "^5.4.2" "typescript": "^5.4.3"
}, },
"prettier": { "prettier": {
"arrowParens": "avoid", "arrowParens": "avoid",

View File

@ -26,10 +26,10 @@ index 883c03b7..0111d616 100644
} }
diff --git a/.eslintrc b/.eslintrc diff --git a/.eslintrc b/.eslintrc
deleted file mode 100644 deleted file mode 100644
index 224ffcb0..00000000 index 80e1014c..00000000
--- a/.eslintrc --- a/.eslintrc
+++ /dev/null +++ /dev/null
@@ -1,268 +0,0 @@ @@ -1,267 +0,0 @@
-{ -{
- "root": true, - "root": true,
- "plugins": [ - "plugins": [
@ -261,7 +261,6 @@ index 224ffcb0..00000000
- { - {
- "files": [ - "files": [
- "utils/**", // TODO - "utils/**", // TODO
- "src/ExportMap.js", // TODO
- ], - ],
- "rules": { - "rules": {
- "no-use-before-define": "off", - "no-use-before-define": "off",

View File

@ -237,7 +237,7 @@ index 64bbc8d5..b5e9c803 100644
const isCreateElement = require('../util/isCreateElement'); const isCreateElement = require('../util/isCreateElement');
const report = require('../util/report'); const report = require('../util/report');
diff --git a/lib/rules/no-unknown-property.js b/lib/rules/no-unknown-property.js diff --git a/lib/rules/no-unknown-property.js b/lib/rules/no-unknown-property.js
index 781e5495..73cc5eb3 100644 index 9491f9c6..44396948 100644
--- a/lib/rules/no-unknown-property.js --- a/lib/rules/no-unknown-property.js
+++ b/lib/rules/no-unknown-property.js +++ b/lib/rules/no-unknown-property.js
@@ -543,7 +543,7 @@ module.exports = { @@ -543,7 +543,7 @@ module.exports = {
@ -258,22 +258,6 @@ index 781e5495..73cc5eb3 100644
return; return;
} }
const name = normalizeAttributeCase(actualName); const name = normalizeAttributeCase(actualName);
@@ -584,6 +584,15 @@ module.exports = {
const tagName = getTagName(node);
+ if (
+ (actualName === 'css' && hasEmotion) ||
+ (tagName === 'style' &&
+ (actualName === 'global' || actualName === 'jsx') &&
+ hasNext)
+ ) {
+ return;
+ }
+
if (tagName === 'fbt' || tagName === 'fbs') { return; } // fbt/fbs nodes are bonkers, let's not go there
if (!isValidHTMLTagInJSX(node)) { return; }
diff --git a/lib/util/annotations.js b/lib/util/annotations.js diff --git a/lib/util/annotations.js b/lib/util/annotations.js
index 60aaef8c..ad8dc0bf 100644 index 60aaef8c..ad8dc0bf 100644
--- a/lib/util/annotations.js --- a/lib/util/annotations.js

1479
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -14,6 +14,7 @@ import { jsDocRules } from './presets/jsdoc';
import { graphqlRules } from './presets/graphql'; import { graphqlRules } from './presets/graphql';
import { localRules } from './presets/local'; import { localRules } from './presets/local';
import { error, warn, off } from './constants'; import { error, warn, off } from './constants';
import { tailwindRules } from './presets/tailwind';
export { error, warn, off }; export { error, warn, off };
@ -118,6 +119,9 @@ export function extendConfig({
const hasJsDoc = plugins.includes('jsdoc'); const hasJsDoc = plugins.includes('jsdoc');
const hasGraphQL = plugins.includes('@graphql-eslint'); const hasGraphQL = plugins.includes('@graphql-eslint');
const hasNext = ensureArray(_extends).some(name => name.includes(':@next/next')); const hasNext = ensureArray(_extends).some(name => name.includes(':@next/next'));
const hasTailwind = ensureArray(_extends).some(name =>
name.includes('plugin:tailwindcss/'),
);
const ruleDir = false; // ?? findCacheDirectory({ name: '_eslint-rules' }); const ruleDir = false; // ?? findCacheDirectory({ name: '_eslint-rules' });
if (ruleDir) { if (ruleDir) {
@ -200,7 +204,7 @@ export function extendConfig({
...reactRules, ...reactRules,
'react/no-unknown-property': [ 'react/no-unknown-property': [
error, error,
{ ignore: hasNext ? ['emotion', 'next'] : ['emotion'] }, { ignore: hasNext ? ['css', 'next'] : ['css'] },
], ],
}), }),
...(hasReactRefresh && { ...(hasReactRefresh && {
@ -209,6 +213,7 @@ export function extendConfig({
...(hasUnicorn && unicornRules), ...(hasUnicorn && unicornRules),
...(hasJsDoc && jsDocRules), ...(hasJsDoc && jsDocRules),
...(hasGraphQL && graphqlRules), ...(hasGraphQL && graphqlRules),
...(hasTailwind && tailwindRules),
...rules, ...rules,
}, },
...rest, ...rest,

5
src/presets/tailwind.ts Normal file
View File

@ -0,0 +1,5 @@
import { off } from '../constants';
export const tailwindRules = {
'tailwindcss/no-custom-classname': off,
} as const;