@crometrics/eslint-config-crometrics-base v3.2.1
Contains the Cro Metrics' JavaScript linting rules for ESLint.
The intent of our ESLint configs is to provide a common set of rules for coding within the Cro Metrics' codebase. Having installable ESLint configs will streamline and simplify using our style guide across various projects/repos easier.
Installation and Ussage Instructions
- Run
npx install-peerdeps @crometrics/eslint-config-crometrics-base@latest - Add the package to the
extendsarray/string in your.eslintrc.*.
Example
An example bare bones .eslintrc.* config with no other rules, plugins, extended configs, etc. would look like:
// .eslintrc.cjs
module.exports = {
extends: ['@crometrics/eslint-config-crometrics-base'],
overrides: [],
};Override specific settings by specifying them in the rules object as normal. See http://eslint.org/docs/developer-guide/shareable-configs for more details.
You can add additional extended configs, plugins, rules, globals, parser options, env options, etc. the same as you normally would.
Example
// eslintrc.cjs
module.exports = {
extends: [
'@crometrics/eslint-config-crometrics-base',
'plugin:react/recommended',
],
plugins: ['react'],
rules: {
// Any project specific rules or rules for plugins/additional configs here
'react/no-unescaped-entities': ['off'],
},
globals: {
// Add any project globals here
PJS: true,
},
};Available Configs
See eslint-config-crometrics/packages/ to view all available configs.
Of note, there is a TypeScript configuration for projects that contain any amount of TypeScript.
- If your project is only JavaScript:
- Install only this module
- If your project contains any TypeScript:
- Install only
eslint-config-crometrics-typescript(Link)
- Install only
IMPORTANT NOTE:
There is no reason to install both eslint-config-crometrics-base and eslint-config-crometrics-typescript in the same project and doing so will give you problems.
Making Changes and Publishing Updates
- Make the changes you want to make in
/packages/eslint-config-crometrics-base/index.jsor/packages/eslint-config-crometrics-base/rules/[filename].js. - Increment
versioninpackage.json. - Commit and push changes to the repo.
- From the root directory of this repo, run
npm publishto publish from the repo to npm. - Run
npm update @crometrics/eslint-config-crometrics-base(or simplynpm updateto update all npm packages) in the projects where the config is installed - Make a post in the
#-engineeringSlack channel informing others to runnpm update @crometrics/eslint-config-crometrics-typescriptornpm updateas well