Repository URL to install this package:
|
Version:
0.2.2 ▾
|
| base.js |
| index.js |
| react.js |
| package.json |
| README.md |
This module contains the default ESLint configurations for Doodle JavaScript modules and React applications
Add eslint and @doodle/eslint-config to the devDependencies
$ yarn add -D eslint @doodle/eslint-config
Create an .eslintrc.js file in your project's root directory and extend the default configuration.
:bulb: The default configuration is for REACT projects
// File: my-web-frontend/.eslintrc.js module.exports = { "extends": ["@doodle/eslint-config"], // Add here your custom rules };
If you have a React application, you can use the React configuration by name, or just pull in the default configuration (they are the same)
// File: web-my-frontend/.eslintrc.js module.exports = { "extends": ["@doodle/eslint-config/react"], // Add here your custom rules };
If you have a JavaScript application, you can use the Base configuration by name, and it will lint your JavaScript
// File: web-js-project/.eslintrc.js module.exports = { "extends": ["@doodle/eslint-config/base"], // Add here your custom rules };
You must run the local installation of ESLint and not the global one, otherwise the custom configuration won't be found. This is the error that would pop up if you use the global ESLint:
Error: Cannot find module '@doodle/eslint-config'
The correct ways of running eslint are as follows:
$ npx eslint src
or
$ ./node_modules/.bin/eslint src
When you want to publish a new version of the module, you can simply update the version in the package.json and run the following command.
$ npm publish