Skip to content

Instantly share code, notes, and snippets.

@mgilangjanuar
Created February 22, 2021 04:06
Show Gist options
  • Save mgilangjanuar/86d880571d03b74055931aaf8065d4d5 to your computer and use it in GitHub Desktop.
Save mgilangjanuar/86d880571d03b74055931aaf8065d4d5 to your computer and use it in GitHub Desktop.
linter for typescript with @typescript-eslint/eslint-plugin: ^4.13.0
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended'
],
parserOptions: {
'project': './tsconfig.json'
},
rules: {
'@typescript-eslint/indent': [
'error',
2
],
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@typescript-eslint/quotes': [
'error',
'single',
{
'avoidEscape': true
}
],
'@typescript-eslint/semi': [
'error',
'never'
],
'@typescript-eslint/type-annotation-spacing': 'error',
'@typescript-eslint/member-delimiter-style': [
'error',
{
'multiline': {
'delimiter': 'comma',
'requireLast': false
},
'singleline': {
'delimiter': 'comma',
'requireLast': false
}
}
],
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars-experimental': 'error',
'no-unused-vars': 'off',
'@typescript-eslint/no-extra-parens': 'error',
'@typescript-eslint/brace-style': 'error',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'no-null/no-null': 'off',
'no-useless-escape': 'off',
'no-trailing-spaces': 'error',
'no-var': 'error',
'prefer-const': 'error',
'spaced-comment': 'error',
'object-curly-spacing': ['error', 'always'],
'space-in-parens': ['error', 'never'],
'array-bracket-spacing': ['error', 'never'],
'space-before-function-paren': [
'error',
{
'named': 'never',
'anonymous': 'always',
'asyncArrow': 'always'
}
],
'@typescript-eslint/naming-convention': [
'error',
{
'format': ['camelCase', 'UPPER_CASE', 'PascalCase'],
'leadingUnderscore': 'allow',
'selector': ['variable', 'function']
}
],
'@typescript-eslint/explicit-module-boundary-types': 'off'
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment