This package incudes standardized ESLint and Prettier configuration, automatically adds lint
NPM script for source code linting and enables auto-formatting in Visual Studio Code.
Install with npm:
npm install @js-bits/formalinter -D
Install with yarn:
yarn add @js-bits/formalinter -D
That's all you need to do.
- Install ESLint and Prettier extensions for VSCode if you haven't already done so.
- Restart VSCode to make sure that updated configuration is applied.
- Enjoy 🎉
Formalinter adds the following to your project's package.json
"scripts": {
...
"lint": "eslint '**/*.{js,jsx}'"
},
"prettier": "@js-bits/formalinter/.prettierrc.json",
"eslintConfig": {
"extends": "@js-bits/eslint-config-formalinter/.eslintrc.json"
}
For further information regarding ESLint and Prettier customization please refer to sharable config docs:
- ESLint: Shareable Configs
- Prettier: Sharing configurations
(!) NOTE: eslint-config-
prefix is required by ESLint
Shareable configs are simply npm packages that export a configuration object. Make sure the module name begins with
eslint-config-
, such aseslint-config-myconfig
. npm scoped modules are also supported, by naming or prefixing the module with@scope/eslint-config
, such as@scope/eslint-config
or@scope/eslint-config-myconfig
.
- https://glebbahmutov.com/blog/configure-prettier-in-vscode/#format-json-files-with-prettier
- https://blog.echobind.com/integrating-prettier-eslint-airbnb-style-guide-in-vscode-47f07b5d7d6a
- https://scotch.io/tutorials/linting-and-formatting-with-eslint-in-vs-code