This repository was archived by the owner on Dec 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathlint.js
More file actions
135 lines (130 loc) · 3.74 KB
/
lint.js
File metadata and controls
135 lines (130 loc) · 3.74 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
124
125
126
127
128
129
130
131
132
133
134
135
const loaderMerge = require('@neutrinojs/loader-merge');
module.exports = (neutrino, options = {}) => {
if (!options.use) {
throw new Error(
'The linting middleware requires a base middleware to extend'
);
}
if (!Array.isArray(options.use)) {
throw new Error(
'The linting middleware requires an array pair of [base, overrides]'
);
}
const [airbnb, overrides] = options.use;
neutrino.use(airbnb, {
eslint: {
emitWarning:
process.env.NODE_ENV === 'development' ||
neutrino.options.command === 'styleguide:start',
baseConfig: {
extends: ['eslint-config-prettier'],
},
plugins: ['eslint-plugin-prettier'],
rules: {
'import/no-extraneous-dependencies': 'off',
// Specify the maximum length of a line in your program
'max-len': [
'error',
80,
2,
{
ignoreUrls: true,
ignoreComments: false,
ignoreStrings: true,
ignoreTemplateLiterals: true,
},
],
// Allow using class methods with static/non-instance functionality
// React lifecycle methods commonly do not use an instance context for
// anything
'class-methods-use-this': 'off',
// Allow console during development, otherwise throw an error
'no-console': process.env.NODE_ENV === 'development' ? 'off' : 'error',
// Allow extra parentheses since multiline JSX being wrapped in parens
// is considered idiomatic
'no-extra-parens': 'off',
// Our frontend strives to adopt functional programming practices,
// so we prefer const over let
'prefer-const': 'error',
'prettier/prettier': [
'error',
{
singleQuote: true,
trailingComma: 'es5',
bracketSpacing: true,
jsxBracketSameLine: true,
},
],
'padding-line-between-statements': [
'error',
{
blankLine: 'always',
prev: ['const', 'let', 'var'],
next: '*',
},
{
blankLine: 'never',
prev: ['const', 'let', 'var'],
next: ['const', 'let', 'var'],
},
{
blankLine: 'always',
prev: ['cjs-import'],
next: '*',
},
{
blankLine: 'always',
prev: ['import'],
next: '*',
},
{
blankLine: 'always',
prev: '*',
next: ['cjs-export'],
},
{
blankLine: 'always',
prev: '*',
next: ['export'],
},
{
blankLine: 'never',
prev: ['import'],
next: ['import'],
},
{
blankLine: 'never',
prev: ['cjs-import'],
next: ['cjs-import'],
},
{
blankLine: 'any',
prev: ['export'],
next: ['export'],
},
{
blankLine: 'any',
prev: ['cjs-export'],
next: ['cjs-export'],
},
{ blankLine: 'always', prev: 'multiline-block-like', next: '*' },
{
blankLine: 'always',
prev: '*',
next: ['if', 'do', 'for', 'switch', 'try', 'while'],
},
{ blankLine: 'always', prev: '*', next: 'return' },
],
'consistent-return': 'off',
'no-unused-expressions': 'off',
'no-shadow': 'off',
'no-return-assign': 'off',
'babel/new-cap': 'off',
'no-mixed-operators': 'off',
},
},
});
if (overrides) {
neutrino.use(loaderMerge('lint', 'eslint'), overrides);
}
};