2.1.0 • Published 3 years ago

@preply/lint-configs v2.1.0

Weekly downloads
2,946
License
ISC
Repository
-
Last release
3 years ago

Installation

  • yarn add -D @preply/lint-configs tslint@5 eslint@5 — explanation
  • Create an .eslintrc.js:
module.exports = {
  extends: require.resolve('@preply/lint-configs/eslint.main.js'),
};
  • Create a .prettierrc.js:
module.exports = {
  ...require('@preply/lint-configs/prettier'),
};
  • Create a .tslint.json:
{
  "extends": [
    "@preply/lint-configs/tslint.json"
  ]
}
  • Put these guys into "scripts" in your package.json:
"lint:es": "eslint src --ext .js,.jsx",
"lint:ts": "tslint  'src/**/*.ts{,x}' --config ./tslint.json --project ./tsconfig.json",
"prettify": "prettier --write \"./src/**/*.{ts,tsx,js}\"",

Tip: pass --fix into both in development:

yarn lint:es --fix
yarn lint:ts --fix
  • Call it on CI (make sure there's no --fix, we want it to block non-compliant code)!