Skip to content

Instantly share code, notes, and snippets.

@eralston
Last active October 3, 2022 16:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eralston/c060fae1e8dfdb425ddcf2fc2ad28f37 to your computer and use it in GitHub Desktop.
Save eralston/c060fae1e8dfdb425ddcf2fc2ad28f37 to your computer and use it in GitHub Desktop.
ESLint Cheat Sheet
// Learn more about Standard JS: https://standardjs.com/index.html
// package.json
{
...
"scripts": {
"validate:ci": "tsc --noEmit && eslint . --fix",
}
...
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^3.5.0",
"eslint": "^7.3.1",
"eslint-config-standard-with-typescript": "^18.0.2",
"eslint-import-resolver-typescript": "^2.0.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jest": "^23.17.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1"
}
...
}
// .eslintrc.js
module.exports = {
root: true,
extends: 'standard-with-typescript',
parserOptions: {
project: './tsconfig.json'
},
overrides: [
Object.assign(
{
files: [
'tests/**/*.test.js',
'tests/**/*.test.ts'
],
env: { jest: true },
plugins: ['jest']
},
require('eslint-plugin-jest').configs.all
)
]
}
// Allow debugger
/* eslint-disable no-debugger */
debugger
/* eslint-enable no-debugger */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment