-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
114 lines (112 loc) · 3.62 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
const prettier = require('./.prettierrc.json');
// or using prettier config javascript
// const prettier = require('./.prettierrc');
/**
* @type {import('eslint').ESLint.ConfigData}
*/
const config = {
// Specifies your current project has own eslint rules without extends parent folder eslint rules
root: true,
// Specifies the ESLint parser
parser: '@typescript-eslint/parser',
env: {
// add support for browser js (window,document,location,etc)
browser: true,
// add amd support
amd: true,
// add node support (module.export,etc)
node: true,
// add jquery support
jquery: true
},
globals: {
adsbygoogle: true,
gtag: true,
$: true,
safelink: true,
google: 'readonly',
gapi: 'readonly'
},
parserOptions: {
// Allows for the parsing of modern ECMAScript features
ecmaVersion: 2020,
// Allows for the use of imports
sourceType: 'module'
// strict nested project to be handled
// project: ['./tsconfig.json'],
},
extends: [
// Uses eslint default recommended rules
'eslint:recommended',
// Uses the recommended rules from the @typescript-eslint/eslint-plugin
'plugin:@typescript-eslint/eslint-recommended',
// Uses the recommended rules from the @typescript-eslint/eslint-plugin
'plugin:@typescript-eslint/recommended',
// Enables eslint-plugin-prettier and eslint-config-prettier.
// This will display prettier errors as ESLint errors.
// Make sure this is always the last configuration in the extends array.
'plugin:prettier/recommended'
],
// override rules for js files
overrides: [
{
files: ['*.js'],
rules: {
// disable require warning on js files
'@typescript-eslint/no-var-requires': 'off',
// disable include refenrences definition files on js
'@typescript-eslint/triple-slash-reference': 'off'
}
}
],
// specify your desired rules for eslint
rules: {
'prettier/prettier': ['error', prettier],
// disable function without boundary return type
'@typescript-eslint/explicit-function-return-type': 'off',
// disable original eslint unused-vars
'no-unused-vars': 'off',
// enable typescript-eslint unused-vars
// and allow unused vars start with underscore (_)
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_'
}
],
// allow any types
'@typescript-eslint/no-explicit-any': 'off',
// enable this variable calls
'@typescript-eslint/no-this-alias': [
'error',
{
// Disallow `const { props, state } = this`; true by default
allowDestructuring: false,
// Allow `const self = this`; `[]` by default
allowedNames: ['self']
}
],
// these ESLint core rules that can cause issues with
// prettier/prettier plugin, so turn them off.
'arrow-body-style': 'off',
'prefer-arrow-callback': 'off',
// ESLint performance issues fixes
// fix eslint-plugin-import
// * TypeScript provides the same checks as part of standard type checking
'import/no-named-as-default-member': 'off',
'import/named': 'off',
'import/namespace': 'off',
'import/default': 'off',
// fix @typescript-eslint
// * disable the base rule as it can report incorrect errors
indent: 'off',
'@typescript-eslint/indent': 'off',
// fix default eslint rules
// * disable the Enforce sorted import declarations within modules
'sort-imports': 'off',
'@typescript-eslint/triple-slash-reference': 'off'
}
};
module.exports = config;