eslint-config-zillow
Zillow's ESLint config, following our code conventions
Usage
To install with all necessary peerDependencies
, use install-peerdeps:
npx install-peerdeps --dev eslint-config-zillow
All exported configs should be added to your ESlint configuration file extends
.
For example, in a JSON .eslintrc
:
{
"extends": "zillow"
}
"extends": "zillow"
Lint all the things, including ECMAScript 6+, React, and Prettier.
If you don't need React, use eslint-config-zillow-base.
"extends": ["zillow", "zillow/jest]
Jest-specific rules and environment added to the default export.
"extends": ["zillow", "zillow/mocha]
Mocha-specific rules and environment added to the default export.
"extends": ["zillow", "zillow/typescript]
TypeScript-specific rules and environment added to the default export.
This config expects your tsconfig.json
to be in the current working directory (relative to your eslint config), which is extremely common. If it is elsewhere (say, a monorepo leaf), you will need to override varios parserOptions
:
module.exports = {
extends: ['zillow', 'zillow/typescript'],
parserOptions: {
tsconfigRootDir: __dirname,
project: ['./tsconfig.eslint.json', './packages/*/tsconfig.json'],
},
};
prettier
Editor Plugin Integration
Unfortunately, super-useful editor plugins like prettier-atom
and prettier-vscode
do not load Prettier settings from ESLint config, which is where we load our Prettier options from. To workaround this, add a .prettierrc.js
or prettier.config.js
file to your root with the following content:
module.exports = require('prettier-config-zillow');
Related
Development
Consider adding test cases if you're making complicated rules changes, like anything involving regexes. Perhaps in a distant future, we could use literate programming to structure our README as test cases for our .eslintrc?
You can run tests (from the repo root) with npm test
.
You can make sure this module lints with itself using npm run lint
(from the repo root).