-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
123 lines (100 loc) · 3.17 KB
/
Copy patheslint.config.js
File metadata and controls
123 lines (100 loc) · 3.17 KB
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
115
116
117
118
119
120
121
122
123
import js from '@eslint/js'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import jsxA11y from 'eslint-plugin-jsx-a11y'
import globals from 'globals'
export default [
{
ignores: ['dist', 'node_modules'],
},
js.configs.recommended,
{
files: ['**/*.{js,jsx}'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
globals: {
...globals.browser,
...globals.node,
chrome: 'readonly',
},
},
plugins: {
react,
'react-hooks': reactHooks,
'jsx-a11y': jsxA11y,
},
settings: {
react: { version: 'detect' },
},
rules: {
'indent': ["warn", "tab"],
'space-in-parens': ['error', 'always'],
'space-in-brackets': ['error', 'always'],
'react/jsx-curly-spacing': ['error', 'always'],
'array-bracket-spacing': ['error', 'always'],
'space-before-function-paren': ['error', 'always'],
'react/jsx-uses-vars': 'error',
// No semi-colons because they're a hassle.
semi: ['error', 'never'],
// Only use parenthesis on arrow functions that need them since it's a hassle.
'arrow-parens': ['error', 'as-needed'],
// Force destructuring assignments to be multiline if they have lots of variables.
'object-curly-newline': ['error', {
ObjectExpression: {
multiline: true,
minProperties: 3,
consistent: true,
},
ObjectPattern: {
multiline: true,
minProperties: 3,
consistent: true,
},
// Force strict formatting on import/export
ImportDeclaration: {
multiline: true,
minProperties: 3,
consistent: false,
},
ExportDeclaration: {
multiline: true,
minProperties: 3,
consistent: false,
},
}],
// Allow assigning same named variables (mainly for function arguments) in inside code-blocks.
'no-shadow': 'off',
// For me it's easier to read nested ternary if you add some formatting.
'no-nested-ternary': 'off',
// Allow tabs and spaces mixed for aesthetics.
'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'],
// Sort to find stuff easier.
'sort-vars': ['error', { ignoreCase: true }],
// 'sort-keys': ["error", "asc", {caseSensitive: false, natural: true}],
// Allow arrays to be consistently vertical or horizontal.
'array-element-newline': ['error', 'consistent'],
'jsdoc/no-undefined-types': 'off',
'@wordpress/no-unguarded-get-range-at': 'off',
// LF style line breaks.
'linebreak-style': ['error', 'unix'],
// Turn this off since it's showing errors when optional chaining "?."
'no-unused-expressions': 'off',
// Fix some import errors.
'import/no-extraneous-dependencies': 'off',
'import/no-unresolved': 'off',
// In array spread, ignore unused args if they start with _
// e.g. const [ _unused, used ] = [ 'a', 'b', 'c' ]
'no-unused-vars': ['error', { varsIgnorePattern: '^_' }],
// Require tabbed indentation in jsx.
'react/jsx-indent': [2, 'tab', { indentLogicalExpressions: true }],
// Disallow unnecessary JSX expressions when literals alone are sufficient.
'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'never' }],
},
},
]