generated from pengx17/logseq-plugin-template-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
106 lines (92 loc) · 4.25 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
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { resolve } = require('path')
module.exports = {
// https://eslint.org/docs/user-guide/configuring#configuration-cascading-and-hierarchy
// This option interrupts the configuration hierarchy at this file
// Remove this if you have an higher level ESLint config file (it usually happens into a monorepos)
root: true,
// https://eslint.vuejs.org/user-guide/#how-to-use-custom-parser
// Must use parserOptions instead of "parser" to allow vue-eslint-parser to keep working
// `parser: 'vue-eslint-parser'` is already included with any 'plugin:vue/**' config and should be omitted
parserOptions: {
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser#configuration
// https://github.com/TypeStrong/fork-ts-checker-webpack-plugin#eslint
// Needed to make the parser take into account 'vue' files
// extraFileExtensions: ['.vue'],
parser: '@typescript-eslint/parser',
project: [resolve(__dirname, './tsconfig.json'), resolve(__dirname, './tsconfig.eslint.json')],
tsconfigRootDir: __dirname,
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
sourceType: 'module' // Allows for the use of imports
},
env: {
browser: true
},
plugins: [
'react-hooks',
],
// Rules order is important, please avoid shuffling them
extends: [
// Base ESLint recommended rules
// 'eslint:recommended',
'standard-with-typescript', // Standard style - https://github.com/standard/eslint-config-standard-with-typescript
// https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#usage
// ESLint typescript rules
// 'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended'
// consider disabling this class of rules if linting takes too long
// 'plugin:@typescript-eslint/recommended-requiring-type-checking', // DISABLED as it was mangling the last import line creating errors and making the files useless
// Uncomment any of the lines below to choose desired strictness,
// but leave only one uncommented!
// See https://eslint.vuejs.org/rules/#available-rules
// 'plugin:vue/essential', // Priority A: Essential (Error Prevention)
// 'plugin:vue/strongly-recommended', // Priority B: Strongly Recommended (Improving Readability)
// 'plugin:vue/recommended', // Priority C: Recommended (Minimizing Arbitrary Choices and Cognitive Overhead)
],
// globals: {
// cordova: true,
// __statics: true,
// process: true,
// Capacitor: true,
// chrome: true,
// },
// add your custom rules here
rules: {
// allow debugger during development only
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
// allow async-await
'generator-star-spacing': 'off',
// allow paren-less arrow functions
'arrow-parens': 'off',
'one-var': 'off',
'prefer-const': 'warn',
'prefer-template': 'warn',
'@typescript-eslint/comma-dangle': ['warn', 'always-multiline'],
// 'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'import/prefer-default-export': 'off',
// 'import/first': 'off',
// 'import/named': 'error',
// 'import/namespace': 'error',
// 'import/default': 'error',
// 'import/export': 'error',
// 'import/extensions': 'warn',
// 'import/no-unresolved': 'warn',
// 'import/no-extraneous-dependencies': 'off',
// 'prefer-promise-reject-errors': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
// TypeScript
quotes: ['warn', 'single'],
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/require-await': 'warn',
'@typescript-eslint/strict-boolean-expressions': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/prefer-ts-expect-error': 'warn',
'@typescript-eslint/restrict-template-expressions': 'warn',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off'
}
}