Skip to content

Commit

Permalink
improve prettier and lint config and performance
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Aug 24, 2018
1 parent 6e01fd5 commit 1b886ee
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 199 deletions.
4 changes: 0 additions & 4 deletions .editorconfig
Expand Up @@ -8,10 +8,6 @@ trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 80

[.prettierrc]
indent_style = space
indent_size = 2

[*.{yml,yaml,json}]
indent_style = space
indent_size = 2
Expand Down
45 changes: 26 additions & 19 deletions .eslintrc.js
@@ -1,7 +1,11 @@
module.exports = {
root: true,
plugins: ["prettier", "node", "jest"],
extends: ["eslint:recommended", "plugin:node/recommended", "plugin:prettier/recommended"],
extends: [
"eslint:recommended",
"plugin:node/recommended",
"plugin:prettier/recommended"
],
env: {
node: true,
es6: true
Expand All @@ -16,8 +20,8 @@ module.exports = {
"no-template-curly-in-string": "error",
"no-caller": "error",
"no-control-regex": "off",
"yoda": "error",
"eqeqeq": "error",
yoda: "error",
eqeqeq: "error",
"global-require": "off",
"brace-style": "error",
"eol-last": "error",
Expand All @@ -27,23 +31,26 @@ module.exports = {
"no-unused-vars": ["error", { args: "none" }],
"no-unsafe-negation": "error",
"no-loop-func": "warn",
"indent": "off",
indent: "off",
"no-console": "off",
"valid-jsdoc": ["error", {
"prefer": {
"return": "returns",
"prop": "property",
"memberof": "DONTUSE",
"class": "DONTUSE",
"inheritdoc": "DONTUSE",
"description": "DONTUSE",
"readonly": "DONTUSE"
},
"preferType": {
"*": "any"
},
"requireReturnType": true
}],
"valid-jsdoc": [
"error",
{
prefer: {
return: "returns",
prop: "property",
memberof: "DONTUSE",
class: "DONTUSE",
inheritdoc: "DONTUSE",
description: "DONTUSE",
readonly: "DONTUSE"
},
preferType: {
"*": "any"
},
requireReturnType: true
}
],
"node/no-unsupported-features": "error",
"node/no-deprecated-api": "error",
"node/no-missing-import": "error",
Expand Down
18 changes: 5 additions & 13 deletions .prettierignore
@@ -1,16 +1,8 @@
# Ignore all paths.
**/*.*

# Enable prettier for the following paths.
!*.{ts,js,json}
!setup/**/*.js
!lib/**/*.js
!bin/*.js
!hot/*.js
!buildin/*.js
!benchmark/**/*.js
# Ignore test fixtures
test
!test/*.js
!tooling/*.js
!test/**/webpack.config.js

# Ignore example fixtures
examples
!examples/**/webpack.config.js
!schemas/**/*.js
10 changes: 9 additions & 1 deletion .prettierrc.js
@@ -1,5 +1,13 @@
module.exports = {
printWidth: 80,
useTabs: true,
tabWidth: 2
tabWidth: 2,
overrides: [
{
files: "*.json",
options: {
useTabs: false
}
}
]
};
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -120,10 +120,10 @@
"pretest": "yarn lint",
"prelint": "yarn setup",
"lint": "yarn code-lint && yarn schema-lint && yarn type-lint",
"code-lint": "eslint --cache setup lib bin hot buildin benchmark tooling \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" \"schemas/**/*.js\"",
"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\"",
"type-lint": "tsc --pretty",
"fix": "yarn code-lint --fix",
"pretty": "prettier --write \"*.{ts,js,json}\" \"setup/**/*.js\" \"lib/**/*.js\" \"bin/*.js\" \"hot/*.js\" \"buildin/*.js\" \"benchmark/**/*.js\" \"tooling/*.js\" \"test/*.js\" \"test/**/webpack.config.js\" \"examples/**/webpack.config.js\" \"schemas/**/*.js\"",
"pretty": "prettier --loglevel warn --write \"*.{ts,js,json}\" \"{setup,lib,bin,hot,buildin,benchmark,tooling,schemas}/**/*.{js,json}\" \"test/*.js\" \"test/{configCases,watchCases,statsCases,hotCases}/**/webpack.config.js\" \"examples/**/webpack.config.js\"",
"schema-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",
"cover": "yarn cover:init && yarn cover:all && yarn cover:report",
Expand Down

0 comments on commit 1b886ee

Please sign in to comment.