Created a new React project. There is almost nothing there -- just SSR, code splitting and a couple of 'hello world!' pages. On top of eslint added prettier. Before I added prettier the lint used to take 10-15 sec. Now I got +2mins for almost empty project:
time yarn lint
yarn lint 3.19s user 0.49s system 2% cpu 2:35.39 total
Thought that I'm linting node_modules. In order to check that updated 2 files:
// node_modules/eslint/lib/rules/no-unused-vars.js
...
create(context) {
const sourceCode = context.getSourceCode();
// ########### LOG #############
console.log(`eslint processing file [${+new Date()}] ${context.getFilename()}`);
const REST_PROPERTY_TYPE = /^(?:RestElement|(?:Experimental)?RestProperty)$/u;
and
// node_modules/eslint-plugin-prettier/eslint-plugin-prettier.js
...
const prettierFileInfo = prettier.getFileInfo.sync(
filepath,
Object.assign(
{},
{ resolveConfig: true, ignorePath: '.prettierignore' },
eslintFileInfoOptions
)
);
// ############## LOG ########################
console.log('Prettier processing file', filepath);
// Skip if file is ignored using a .prettierignore file
if (prettierFileInfo.ignored) {
Would really appreciate it if you could tell me a better way to list processed files. A trick with
"scripts": {
...
"lint": " DEBUG=eslint:* eslint --ext .js --fix server src tools",
gave too much data.
Not sure do I even need this file
# .prettierignore
# Ignore everything:
/*
# Good guys
!/src
!/server
!/tools
The output showed me that difference between timestamps of the first and the last file is ~1.5 sec.
eslint processing file [1592686834050] /Users/...
Prettier processing file...
....
eslint processing file [1592686835724] /Users/...
Prettier processing file ...
Just wondering, what for are used the rest of 1500 sec?
.eslintrc file
{
"parser": "babel-eslint",
"extends": [
"airbnb",
"plugin:prettier/recommended"
],
"env": {
"browser" : true,
"jest": true
},
"plugins": [
"prettier",
"react-hooks",
"jsdoc",
"jest"
],
"rules": {
"max-len": [2, 120],
"react/jsx-wrap-multilines": ["error", {"declaration": false, "assignment": false}],
"import/prefer-default-export": 0,
"react/jsx-filename-extension": 0,
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"arrow-body-style": ["error", "as-needed"],
"curly": ["error", "all"],
"jsdoc/check-indentation": "error",
"jsdoc/check-param-names": "error",
"jsdoc/check-property-names": "error",
"jsdoc/check-tag-names": "error",
"jsdoc/require-hyphen-before-param-description": ["error", "never"],
"jsdoc/require-param-description": "error",
"jsdoc/require-param-name": "error",
"jsdoc/require-param-type": "error",
"jsdoc/require-param": "error",
"jsdoc/require-property": "error",
"jsdoc/require-property-name": "error",
"jsdoc/require-property-type": "error",
"jsdoc/require-returns-description": "error",
"jsdoc/require-returns-type": "error",
"jsdoc/require-returns": "error"
},
"settings": {
"import/resolver": {
"node": {
"paths": ["src", "server", "tools"]
}
}
},
"overrides": [
{
"files": [ "**/*.stories.js", "**/*.story.js" ],
"rules": {
"import/no-extraneous-dependencies": 0
}
}
]
}
Restarted Mac and got a normal processing time (~4 secs):
time yarn lint
yarn lint 4.09s user 0.61s system 109% cpu 4.279 total
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With