Shareable ESLint, Prettier, and TypeScript configuration used in Runly javascript applications.
npm install @runly/eslint-config @runly/prettier-config prettier @runly/tsconfig typescript --save-dev
Add to your .eslintrc.js
:
module.exports = {
extends: ["@runly"],
parserOptions: {
project: "tsconfig.json"
},
root: true
};
Add a prettier
field to your package.json
to use the shared prettier config:
{
"name": "my-cool-app",
"version": "1.0.0",
"prettier": "@runly/prettier-config"
}
Add a tsconfig.json
to the root of your project with contents similar to the folowing:
{
"extends": "@runly/tsconfig",
"include": ["src", "test"],
"compilerOptions": {
"outDir": "dist"
}
}
You should be able to use your favorite editor's (*cough* VS Code) ESLint and/or Prettier plugin to easily format your code on save or with the Format command.
When adding rules or plugins, put them into the correct js file based on category (e.g. add react rules to react.js
). Make sure to add a small comment explaining what the rule does (feel free to be as snarky as possible) along with a link to the rule documentation.
When making changes, be sure to follow semantic versioning.
- Any new error rules you add should be a major version bump.
- Any more restrictive changes to existing error rules should be a major version bump.
- Any easing of restrictions to existing error rules can be a minor version bump.
- Any new fixable error rules can be a minor version bump.
- Any addition or changes to warning rules should be a minor version bump.
- Any bug fixes should be a patch version bump.
- Anytime you realize you broke one of these rules, fixing it should be a patch version bump.