mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-09 02:23:44 +08:00
chore: Use override instead of env to control eslint on markdown (#23454)
This commit is contained in:
parent
428b07625c
commit
9a43e439b3
68
.eslintrc.js
68
.eslintrc.js
@ -1,4 +1,8 @@
|
|||||||
const eslintrc = {
|
const commonGlobals = {
|
||||||
|
gtag: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
extends: [
|
extends: [
|
||||||
'airbnb',
|
'airbnb',
|
||||||
'prettier',
|
'prettier',
|
||||||
@ -31,6 +35,30 @@ const eslintrc = {
|
|||||||
'@typescript-eslint/no-unused-expressions': 2,
|
'@typescript-eslint/no-unused-expressions': 2,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
files: ['*.md'],
|
||||||
|
globals: {
|
||||||
|
...commonGlobals,
|
||||||
|
React: true,
|
||||||
|
ReactDOM: true,
|
||||||
|
mountNode: true,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
indent: 0,
|
||||||
|
'no-console': 0,
|
||||||
|
'no-plusplus': 0,
|
||||||
|
'eol-last': 0,
|
||||||
|
'no-script-url': 0,
|
||||||
|
'prefer-rest-params': 0,
|
||||||
|
'react/no-access-state-in-setstate': 0,
|
||||||
|
'react/destructuring-assignment': 0,
|
||||||
|
'react/no-multi-comp': 0,
|
||||||
|
'jsx-a11y/href-no-hash': 0,
|
||||||
|
'import/no-extraneous-dependencies': 0,
|
||||||
|
'import/no-unresolved': 0,
|
||||||
|
'jsx-a11y/control-has-associated-label': 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
camelcase: 0,
|
camelcase: 0,
|
||||||
@ -91,38 +119,10 @@ const eslintrc = {
|
|||||||
'jest/no-test-callback': 0,
|
'jest/no-test-callback': 0,
|
||||||
'jest/expect-expect': 0,
|
'jest/expect-expect': 0,
|
||||||
'react-hooks/rules-of-hooks': 2, // Checks rules of Hooks
|
'react-hooks/rules-of-hooks': 2, // Checks rules of Hooks
|
||||||
"unicorn/better-regex": 2,
|
'unicorn/better-regex': 2,
|
||||||
"unicorn/prefer-trim-start-end": 2,
|
'unicorn/prefer-trim-start-end': 2,
|
||||||
"unicorn/expiring-todo-comments": 2,
|
'unicorn/expiring-todo-comments': 2,
|
||||||
"unicorn/no-abusive-eslint-disable": 2,
|
'unicorn/no-abusive-eslint-disable': 2,
|
||||||
},
|
|
||||||
globals: {
|
|
||||||
gtag: true,
|
|
||||||
},
|
},
|
||||||
|
globals: commonGlobals,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (process.env.RUN_ENV === 'DEMO') {
|
|
||||||
eslintrc.globals = Object.assign(eslintrc.globals, {
|
|
||||||
React: true,
|
|
||||||
ReactDOM: true,
|
|
||||||
mountNode: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
Object.assign(eslintrc.rules, {
|
|
||||||
indent: 0,
|
|
||||||
'no-console': 0,
|
|
||||||
'no-plusplus': 0,
|
|
||||||
'eol-last': 0,
|
|
||||||
'no-script-url': 0,
|
|
||||||
'prefer-rest-params': 0,
|
|
||||||
'react/no-access-state-in-setstate': 0,
|
|
||||||
'react/destructuring-assignment': 0,
|
|
||||||
'react/no-multi-comp': 0,
|
|
||||||
'jsx-a11y/href-no-hash': 0,
|
|
||||||
'import/no-extraneous-dependencies': 0,
|
|
||||||
'import/no-unresolved': 0,
|
|
||||||
'jsx-a11y/control-has-associated-label': 0,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = eslintrc;
|
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
"lint-fix:demo": "eslint-tinker ./components/*/demo/*.md",
|
"lint-fix:demo": "eslint-tinker ./components/*/demo/*.md",
|
||||||
"lint-fix:script": "npm run lint:script -- --fix",
|
"lint-fix:script": "npm run lint:script -- --fix",
|
||||||
"lint-fix:style": "npm run lint:style -- --fix",
|
"lint-fix:style": "npm run lint:style -- --fix",
|
||||||
"lint:demo": "cross-env RUN_ENV=DEMO eslint components/*/demo/*.md --ext '.md'",
|
"lint:demo": "eslint components/*/demo/*.md",
|
||||||
"lint:deps": "antd-tools run deps-lint",
|
"lint:deps": "antd-tools run deps-lint",
|
||||||
"lint:md": "remark components/",
|
"lint:md": "remark components/",
|
||||||
"lint:script": "eslint . --ext '.js,.jsx,.ts,.tsx'",
|
"lint:script": "eslint . --ext '.js,.jsx,.ts,.tsx'",
|
||||||
|
Loading…
Reference in New Issue
Block a user