Skip to content

Instantly share code, notes, and snippets.

@MohammedALREAI
Last active April 5, 2021 21:33
Show Gist options
  • Save MohammedALREAI/cdff1efd79e7e9febb9cd75b80eee6cb to your computer and use it in GitHub Desktop.
Save MohammedALREAI/cdff1efd79e7e9febb9cd75b80eee6cb to your computer and use it in GitHub Desktop.
setup the eslint
// .eslint.js=>
module.exports = {
parser: '@typescript-eslint/parser',
overrides: [
{
files: ['*.ts', '*.tsx'], // Your TypeScript files extension
parserOptions: {
project: ['./tsconfig.json'], // Specify it only for TypeScript files
},
}
],
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
root: true,
env: {
node: true,
},
rules: {
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/ban-types': 'off',
},
};
// package.json
=>
// "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
// "lint": "eslint \"src/**/*.ts\" --fix",
// "husky": {
// "hooks": {
// "pre-commit": "lint-staged",
// "pre-push": "yarn lint",
// "post-rebase": "yarn install"
// }
// },
// "lint-staged": {
// "*.{js,ts,tsx}": [
// "eslint --fix"
// ]
// }
// package =>
// prettier tslint-config-prettier tslint-plugin-prettier husky lint-staged eslint eslint-config-prettier
// eslint-plugin-import @typescript-eslint/eslint-plugin typescript-eslint/parser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment