Skip to content

Instantly share code, notes, and snippets.

@p0vidl0
Last active October 22, 2020 02:13
Show Gist options
  • Save p0vidl0/51c849c69fa5f61d204bae4e2fbea3d3 to your computer and use it in GitHub Desktop.
Save p0vidl0/51c849c69fa5f61d204bae4e2fbea3d3 to your computer and use it in GitHub Desktop.
Dev dependencies for Node.js with Typescript, ESLint and Prettier

Dev dependencies for Node.js with Typescript, ESLint and Prettier

Copy attached files to a blank project root directory and run commands:

npm init
bash ./install-dev-dependencies.sh
**/*.js
node_modules/
env:
browser: false
node: true
es6: true
jest: true
parser: "@typescript-eslint/parser"
plugins:
- "@typescript-eslint/eslint-plugin"
- "unused-imports"
- "security"
extends:
- "airbnb-typescript/base"
- "plugin:security/recommended"
- "plugin:@typescript-eslint/eslint-recommended"
- "plugin:@typescript-eslint/recommended"
- "plugin:prettier/recommended"
- "prettier/@typescript-eslint"
parserOptions:
sourceType: module
ecmaVersion: 2018
project: tsconfig.json
rules:
"@typescript-eslint/interface-name-prefix": off
semi:
- error
- always
quotes:
- error
- single
"@typescript-eslint/explicit-function-return-type": off
"@typescript-eslint/no-explicit-any": off
"@typescript-eslint/member-delimiter-style": error
"@typescript-eslint/no-unused-vars": off
unused-imports/no-unused-imports-ts: error
unused-imports/no-unused-vars-ts:
- error
- vars: all
varsIgnorePattern: "^_"
args: after-used
argsIgnorePattern: "^_"
object-curly-newline:
- error
- ObjectExpression:
minProperties: 6
multiline: true
consistent: true
node/no-unsupported-features/es-syntax: off
no-await-in-loop: 0
import/prefer-default-export: off
max-len:
- error
- code: 120
ignoreStrings: true
eol-last: error
class-methods-use-this: 0
no-underscore-dangle:
- error
- allowAfterSuper: true
allowAfterThis: true
no-plusplus:
- error
- allowForLoopAfterthoughts: true
security/detect-object-injection: off
# arrow-parens:
# - 2
# - "as-needed"
# - requireForBlockBody: true
settings:
import/resolver:
node:
extensions:
- ".ts"
{
"semi": true,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 105,
"tabWidth": 2,
"bracketSpacing": true,
"arrowParens": "always",
"parser": "typescript"
}
npm install --save-dev eslint eslint-config-airbnb-typescript eslint-config-prettier eslint-plugin-import eslint-plugin-prettier eslint-plugin-security eslint-plugin-unused-imports @typescript-eslint/eslint-plugin @typescript-eslint/parser ts-node typescript prettier @types/node
{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "es2017",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment