My personal & professional linting setup. Run's Prettier as an ESLint rule via their ESLint plugin. Dynamic support for react or non-react applications depending on your project dependencies. Dynamic inclusion of Kent C Dodds' ESLint Jest config depending on your project dependencies.
Convenient opt-in configs for projects using Docker or Ethereum to avoid common false positives.
To understand more, see https://github.com/codfish/eslint-config-codfish.
To avoid having to manually setup everything and add all configuration/boilerplate code to your project, use cod-scripts instead. It was forked and extended from kcd-scripts (inspired by react-scripts
).
You may be able to uninstall a number of top-level dependencies from your project but be careful.
npm uninstall @babel/core @babel/cli @babel/preset-env @babel/preset-react eslint eslint-config-codfish prettier husky lint-staged jest @commitlint/cli @commitlint/config-conventional markdownlint-cli
npm install --save-dev cod-scripts
npm install --save @babel/runtime
Full usage: https://github.com/codfish/cod-scripts#usage
- Delete configuration.
sh -c 'rm -f .babelrc* .eslintrc* .eslintignore .huskyrc* .lintstagedrc* .prettierrc* .prettierignore jest.config.js .commitlintrc* commitlint* .markdownlint*'
- Delete any configs from the package.json, i.e.
jest
. - Update
package.json
with the following:
"eslintConfig": {
"extends": [
"./node_modules/cod-scripts/eslint.js"
]
},
"husky": {
"hooks": {
"pre-commit": "cod-scripts pre-commit",
"commit-msg": "cod-scripts commitlint -E HUSKY_GIT_PARAMS"
}
}
- Adding
eslintConfig
to package.json is not required in theory but helps your editor enforce your eslint configuration. - If you're building a dapp, you can extend
codfish/dapp
as well to adjust some eslint rules that throw false positive errors.
"eslintConfig": {
"extends": [
"./node_modules/cod-scripts/eslint.js",
"codfish/dapp"
]
},
- Add desired scripts to
package.json
First of all, thanks for these scripts, love it!
Also, I added an extra install step:
npm install -g markdownlint-cli
since this is a gist I could not send you a pull request, see my fork: https://gist.github.com/Joostvanderlaan/55bf4c941fcf9ce80a4c5fd54a6b9e2c