Last active
October 3, 2022 16:58
-
-
Save eralston/c060fae1e8dfdb425ddcf2fc2ad28f37 to your computer and use it in GitHub Desktop.
ESLint Cheat Sheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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