Install the correct versions of each package, which are listed by the command:
(
export PKG=eslint-config-mifi;
npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs yarn add -D "$PKG"
)
See also eslint-config-airbnb
// .eslintrc.js
module.exports = {
extends: ['mifi'],
overrides: [
// In react/web code
{
files: ['./src/**/*.{js,mjs,cjs,mjs,jsx,ts,mts,tsx}'],
env: {
node: false,
browser: true,
},
},
// In electron renderer, dependencies should be devDependencies (to prevent them from being included in the Electron ASAR package)
{
files: ['./src/{renderer,preload}/**/*.{js,mjs,cjs,mjs,jsx,ts,mts,tsx}'],
env: {
node: false,
browser: true,
},
rules: {
'import/no-extraneous-dependencies': ['error', {
devDependencies: true,
optionalDependencies: false,
}],
},
},
],
}
npx eslint --print-config test-fixtures/React.tsx
Integrate more rules:
- AirBnB typescript fixes: https://github.com/iamturns/eslint-config-airbnb-typescript/blob/8ef77c928c97d977f053c9c638831363a715d4a9/lib/shared.js#L31
- https://github.com/eslint-community/eslint-plugin-n
- https://github.com/eslint-community/eslint-plugin-security
npm i -g np
np