Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize eslint script #9613

Merged
merged 4 commits into from Aug 22, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions .eslintignore
@@ -0,0 +1,6 @@
node_modules
test/**
shaodahong marked this conversation as resolved.
Show resolved Hide resolved
*.d.ts
examples/**/*.js
!examples/*/webpack.config.js
!.*.js
21 changes: 14 additions & 7 deletions .eslintrc.js
Expand Up @@ -11,7 +11,10 @@ module.exports = {
es6: true
},
parserOptions: {
ecmaVersion: 2017
ecmaVersion: 2017,
ecmaFeatures: {
experimentalObjectRestSpread: true
sokra marked this conversation as resolved.
Show resolved Hide resolved
}
},
rules: {
"prettier/prettier": "error",
Expand Down Expand Up @@ -55,12 +58,16 @@ module.exports = {
jsdoc: {
// supported tags https://github.com/microsoft/TypeScript-wiki/blob/master/JSDoc-support-in-JavaScript.md
tagNamePreference: {
...(['implements', 'const', 'memberof', 'readonly', 'yields'].reduce((acc, tag) => {
acc[tag] = {
message: `@${tag} currently not supported in Typescript`
};
return acc;
}, {})),
// eslint-disable-next-line node/no-unsupported-features,node/no-unsupported-features/es-syntax
...["implements", "const", "memberof", "readonly", "yields"].reduce(
(acc, tag) => {
acc[tag] = {
message: `@${tag} currently not supported in Typescript`
};
return acc;
},
{}
),
extends: "extends",
return: "returns",
constructor: "constructor",
Expand Down
2 changes: 1 addition & 1 deletion _SETUP.md
Expand Up @@ -67,7 +67,7 @@ yarn pretty

This performs linting on:

* eslint (code-lint script)
* eslint (eslint script)
* schema + dependencies (jest-lint script)
* types (type-lint script)
* format + generated files (special-lint script)
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Expand Up @@ -71,7 +71,7 @@ jobs:
- script: |
set -e
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
yarn -s run code-lint --format junit > junit.xml
yarn -s run eslint --format junit > junit.xml
yarn jest-lint
yarn type-lint
yarn special-lint
Expand Down
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -119,12 +119,12 @@
"build:examples": "cd examples && node buildAll.js",
"pretest": "yarn lint",
"prelint": "yarn setup",
"lint": "yarn code-lint && yarn jest-lint && yarn type-lint && yarn special-lint",
"code-lint": "eslint --cache \"{setup,lib,bin,hot,buildin,benchmark,tooling,schemas}/**/*.js\" \"test/*.js\" \"test/{configCases,watchCases,statsCases,hotCases}/**/webpack.config.js\" \"examples/**/webpack.config.js\"",
"lint": "yarn eslint && yarn jest-lint && yarn type-lint && yarn special-lint",
"eslint": "eslint . --ext '.js'",
shaodahong marked this conversation as resolved.
Show resolved Hide resolved
"type-lint": "tsc --pretty",
"special-lint": "node tooling/inherit-types && node tooling/format-schemas && node tooling/compile-to-definitions",
"special-lint-fix": "node tooling/inherit-types --write --override && node tooling/format-schemas --write && node tooling/compile-to-definitions --write",
"fix": "yarn code-lint --fix && yarn special-lint-fix",
"fix": "yarn eslint --fix && yarn special-lint-fix",
"pretty": "prettier --loglevel warn --write \"*.{ts,js,json,yml,yaml}\" \"{setup,lib,bin,hot,buildin,benchmark,tooling,schemas}/**/*.{js,json}\" \"test/*.js\" \"test/{configCases,watchCases,statsCases,hotCases}/**/webpack.config.js\" \"examples/**/webpack.config.js\"",
"jest-lint": "node --max-old-space-size=4096 node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.lint.js\" --no-verbose",
"benchmark": "node --max-old-space-size=4096 --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"<rootDir>/test/*.benchmark.js\" --runInBand",
Expand Down