MailOnline ESlint Typescript configuration.
- Add
eslint-config-ts-mailonline
,eslint
,typescript
,prettier
,husky
, andpretty-quick
as development dependencies:
yarn add --dev eslint-config-ts-mailonline eslint typescript prettier husky pretty-quick
- Create a
tsconfig.eslint.json
file (this is a technicality due to the way the eslint typescript parser works):
{
"compilerOptions": {"strict": true},
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules", "dist", "coverage"]
}
- Create ESLint configuration file (
.eslintrc.json
) that extendsts-mailonline
:
{
"extends": ["ts-mailonline", "ts-mailonline/react"],
"parserOptions": {
"project": "./tsconfig.eslint.json"
}
}
- Create
prettier.config.js
on the root of your project with these contents:
module.exports = require('eslint-config-ts-mailonline/prettier');
- Create an
.eslintignore
file:
bin/
dist/
coverage/
dev/
node_modules/
*.css.d.ts
- Add the following script command to your
package.json
:
{
"lint": "tsc --noEmit && eslint './**/*.{js,jsx,ts,tsx}'"
}
- Add the following pre-commit hook to your husky pre-commit script:
pretty-quick --staged && yarn run lint
Any changes to this package that might cause code using it to not validate anymore, will be a semver-major change.