A collection of configurations for my personal coding style.
- Eslint-only, no prettier. Use exlint format on save instead.
Install VS Code ESLint extension
Add the following settings to your .vscode/settings.json:
{
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
}
- Open the Settings dialog (
Ctrl + Alt + S
) - Go to
Languages & Frameworks -> JavaScript -> Code Quality Tools -> ESLint
- Select the
Run eslint --fix
on save checkbox.
Refer to JetBrains Docs
Install with the package manager of your choosing:
pnpm add @cjmosure/style
// .eslintrc.js
const { generateEslintConfig } = require("./src/eslint");
module.exports = generateEslintConfig();
// .eslintrc.js
const { generateEslintReactConfig } = require("./src/eslint");
module.exports = generateEslintReactConfig();
You can pass overrides to the generateEslintConfig()
or generateEslintReactConfig()
functions as a parameter. Overrides are deep-merged using Lodash merge. For example:
// .eslintrc.js
const { generateEslintReactConfig } = require("./src/eslint");
module.exports = generateEslintConfig({
rules: {
"@typescript-eslint/no-array-constructor": "off",
},
});
- Refactor into https://eslint.style/
- fix: @typescript-eslint/no-extra-semi
- Create a install utility that can create an eslint config, install the package, add npm scripts "npx @cjmosure/style init"
- Coverage badge: https://github.com/marketplace/actions/coverage-badge
- Jest coverage reporter: https://github.com/marketplace/actions/jest-coverage-report