-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
60 lines (59 loc) · 1.78 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
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
parser: '@babel/eslint-parser',
ecmaVersion: 2020, // 支援 ECMAScript2020
sourceType: 'module', // 使用 ECMAScript ****module
ecmaFeatures: {
jsx: true, // 支援 JSX
experimentalObjectRestSpread: true,
},
},
// 加上 ts 相關規則
overrides: [
{
files: ['*.ts', '*.tsx'],
extends: [
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/recommended',
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
},
],
extends: [
'plugin:import/typescript',
'plugin:tailwindcss/recommended',
'plugin:@next/next/recommended',
'plugin:react/recommended',
],
// 加上 no console log 規則
rules: {
'no-console': 'error',
'tailwindcss/no-contradicting-classname': 'error',
'tailwindcss/classnames-order': 'off',
'tailwindcss/enforces-negative-arbitrary-values': 'error',
'tailwindcss/enforces-shorthand': 'off',
'tailwindcss/migration-from-tailwind-2': 'error',
'tailwindcss/no-arbitrary-value': 'error',
'tailwindcss/no-custom-classname': 'warn',
},
// 整合 prettier 和解決 prettier 衝突問題
plugins: ['tailwindcss', '@babel', 'prettier', 'react'],
settings: {
tailwindcss: {
// These are the default values but feel free to customize
callees: ['classnames', 'clsx', 'ctl'],
config: 'tailwind.config.js',
cssFiles: ['**/*.css', '!**/node_modules', '!**/.*', '!**/dist', '!**/build'],
cssFilesRefreshRate: '5_000',
removeDuplicates: true,
whitelist: [],
},
react: {
version: 'detect',
},
},
env: {browser: true, node: true, es6: true},
};