-
Notifications
You must be signed in to change notification settings - Fork 1
/
.eslintrc.cjs
81 lines (79 loc) · 2.96 KB
/
.eslintrc.cjs
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
const prettier = require('./.prettierrc.json');
/**
* @type {import("eslint").ESLint.Options}
*/
const config = {
// Specifies your current project has own eslint rules without extends parent folder eslint rules
root: true,
// .eslintignore migration
ignorePatterns: [
'*.md',
'**/tmp/**',
'*.html',
'*.py',
'*.txt',
'**/app/**',
'**/dist/**',
'!.*.{js,cjs,mjs}'
],
noInlineConfig: false,
reportUnusedDisableDirectives: true,
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
env: {
browser: true, // add support for browser js (window,document,location,etc)
amd: true, // add amd support
node: true // add node support (module.export,etc)
},
parserOptions: {
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
sourceType: 'module' // Allows for the use of imports
},
extends: [
'eslint:recommended', // uses eslint default recommended
'plugin:@typescript-eslint/eslint-recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'plugin:prettier/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.
],
// override rules for js files
overrides: [
{
files: ['*.js', '*.cjs'],
rules: {
'@typescript-eslint/no-var-requires': 'off', // disable require warning on js files
'@typescript-eslint/no-require-imports': 'off' // disable require warning on js files
}
}
],
// specify your desired rules for eslint
rules: {
'prettier/prettier': ['error', prettier],
'@typescript-eslint/explicit-function-return-type': 'off', // disable function without return type
'no-unused-vars': 'off', // disable original eslint unused-vars
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_'
}
], // enable typescript-eslint unused-vars and allow unused vars start with underscore (_)
'@typescript-eslint/no-explicit-any': 'off', // allow any types
'@typescript-eslint/no-this-alias': [
// rules for this binding
'error',
{
allowDestructuring: false, // Disallow `const { props, state } = this`; true by default
allowedNames: ['self'] // Allow `const self = this`; `[]` by default
}
],
// "arrow-body-style" and "prefer-arrow-callback" are two ESLint core rules that can cause issues with prettier/prettier plugin, so turn them off.
'arrow-body-style': 'off',
'prefer-arrow-callback': 'off'
},
globals: {
$: 'readonly', // jQuery is assigned to $
jQuery: 'readonly', // jQuery is also available as jQuery
adsbygoogle: 'writable'
}
};
module.exports = config;