-
Notifications
You must be signed in to change notification settings - Fork 2
/
recommended-react.js
56 lines (54 loc) · 2.04 KB
/
recommended-react.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
'use strict'
const recommendedConfiguration = require('./recommended')
module.exports = {
...recommendedConfiguration,
extends: [
'airbnb',
...recommendedConfiguration.extends.slice(1, recommendedConfiguration.extends.length),
],
rules: {
...recommendedConfiguration.rules,
'import/extensions': [
...recommendedConfiguration.rules['import/extensions'].slice(0, 2),
{
...recommendedConfiguration.rules['import/extensions'][2],
jsx: 'never',
tsx: 'never',
},
],
'react/jsx-filename-extension': [
'error',
{
extensions: ['.jsx', '.tsx'],
},
],
'simple-import-sort/imports': [
'warn',
{
groups: [
// Node.js builtins generated from a regex (ref: https://git.io/JMJfU)
[`^(${require('module').builtinModules.join('|')})(/|$)`],
// Third-party modules (side effects)
['^\\u0000'],
// Third-party stylesheets (side effects)
['^\\u0000@?\\w.*\\.(s?css|less)$'],
// Internal stylesheets (side effects)
['^\\u0000\\..*\\.(s?css|less)$'],
// React and related modules
['^react'],
// Third-party modules
['^@?\\w'],
// Internal parent-level modules
['^\\.\\.(?!/?$)', '^\\.\\./?$'],
// Internal same-level modules
['^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
// Internal CSS Modules
['^.*\\.module\\.css$'],
// Internal type imports as a separate group
// (sorting like non-type imports are grouped)
['^@?\\w.*\\u0000$', '^[^.].*\\u0000$', '^\\..*\\u0000$'],
],
},
],
},
}