@towns-labs/eslint-config 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/README.md +3 -0
- package/package.json +9 -0
- package/react.js +50 -0
- package/typescript.js +95 -0
package/CHANGELOG.md
ADDED
package/README.md
ADDED
package/package.json
ADDED
package/react.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
parser: '@typescript-eslint/parser',
|
|
3
|
+
plugins: ['@typescript-eslint', 'import', 'react'],
|
|
4
|
+
extends: [
|
|
5
|
+
'eslint:recommended',
|
|
6
|
+
'plugin:@typescript-eslint/recommended',
|
|
7
|
+
'plugin:react/jsx-runtime',
|
|
8
|
+
'plugin:react-hooks/recommended',
|
|
9
|
+
'plugin:import-x/warnings',
|
|
10
|
+
'plugin:import-x/typescript',
|
|
11
|
+
],
|
|
12
|
+
rules: {
|
|
13
|
+
curly: 'warn',
|
|
14
|
+
'@typescript-eslint/no-base-to-string': 'error',
|
|
15
|
+
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
|
|
16
|
+
'import-x/no-named-as-default-member': 'off',
|
|
17
|
+
'react/display-name': 'off',
|
|
18
|
+
'react/jsx-boolean-value': ['warn', 'never'],
|
|
19
|
+
'react/jsx-curly-brace-presence': ['error', { props: 'never', children: 'ignore' }],
|
|
20
|
+
'react/jsx-wrap-multilines': 'error',
|
|
21
|
+
'react/no-array-index-key': 'error',
|
|
22
|
+
'react/no-multi-comp': 'off',
|
|
23
|
+
'react/prop-types': 'off',
|
|
24
|
+
'react/self-closing-comp': 'warn',
|
|
25
|
+
|
|
26
|
+
'react/jsx-sort-props': [
|
|
27
|
+
'warn',
|
|
28
|
+
{
|
|
29
|
+
shorthandFirst: true,
|
|
30
|
+
callbacksLast: true,
|
|
31
|
+
noSortAlphabetically: true,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
'import-x/no-cycle': ['warn'],
|
|
35
|
+
'import-x/order': [
|
|
36
|
+
'error',
|
|
37
|
+
{
|
|
38
|
+
groups: ['external', 'internal'],
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
'sort-imports': [
|
|
42
|
+
'warn',
|
|
43
|
+
{
|
|
44
|
+
ignoreCase: false,
|
|
45
|
+
ignoreDeclarationSort: true,
|
|
46
|
+
ignoreMemberSort: false,
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
}
|
package/typescript.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Note: `parser` and `parserOptions` should be always provided on the package level given the way eslint resolves parser options paths
|
|
4
|
+
* parser: '@typescript-eslint/parser',
|
|
5
|
+
* parserOptions: {
|
|
6
|
+
* ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
|
|
7
|
+
* sourceType: 'module', // Allows for the use of imports
|
|
8
|
+
* project: './tsconfig.json',
|
|
9
|
+
* tsconfigRootDir: './',
|
|
10
|
+
* },
|
|
11
|
+
*/
|
|
12
|
+
env: {
|
|
13
|
+
es6: true,
|
|
14
|
+
commonjs: true,
|
|
15
|
+
},
|
|
16
|
+
parserOptions: {
|
|
17
|
+
ecmaVersion: 'latest',
|
|
18
|
+
sourceType: 'module',
|
|
19
|
+
},
|
|
20
|
+
extends: [
|
|
21
|
+
'eslint:recommended',
|
|
22
|
+
'plugin:@typescript-eslint/recommended',
|
|
23
|
+
'plugin:@typescript-eslint/recommended-requiring-type-checking',
|
|
24
|
+
'plugin:import-x/typescript',
|
|
25
|
+
'plugin:prettier/recommended',
|
|
26
|
+
],
|
|
27
|
+
plugins: ['@typescript-eslint', 'import-x'],
|
|
28
|
+
overrides: [
|
|
29
|
+
{
|
|
30
|
+
files: ['*.ts', '*.tsx'],
|
|
31
|
+
parser: '@typescript-eslint/parser',
|
|
32
|
+
plugins: ['@typescript-eslint/eslint-plugin'],
|
|
33
|
+
rules: {
|
|
34
|
+
// Overwrites ts rules that conflicts with basic eslint rules
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* `no-shadow` doesn't support Typescript enums
|
|
38
|
+
* see https://github.com/typescript-eslint/typescript-eslint/issues/2483
|
|
39
|
+
*/
|
|
40
|
+
'no-shadow': 'off',
|
|
41
|
+
'@typescript-eslint/no-shadow': 'error',
|
|
42
|
+
|
|
43
|
+
'no-unused-vars': 'off',
|
|
44
|
+
'@typescript-eslint/no-unused-vars': [
|
|
45
|
+
'error',
|
|
46
|
+
{
|
|
47
|
+
argsIgnorePattern: '^_',
|
|
48
|
+
varsIgnorePattern: '^_',
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
rules: {
|
|
55
|
+
'no-console': 'error',
|
|
56
|
+
'no-void': ['error', { allowAsStatement: true }],
|
|
57
|
+
'no-constant-condition': 'off',
|
|
58
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
59
|
+
'@typescript-eslint/require-await': 'off',
|
|
60
|
+
'@typescript-eslint/no-misused-promises': [
|
|
61
|
+
'error',
|
|
62
|
+
{
|
|
63
|
+
checksVoidReturn: false,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Import eslint rules
|
|
69
|
+
*/
|
|
70
|
+
'import-x/no-cycle': ['error', { ignoreExternal: true }],
|
|
71
|
+
'import-x/no-useless-path-segments': 'error',
|
|
72
|
+
'import-x/no-extraneous-dependencies': 'error',
|
|
73
|
+
'import-x/order': [
|
|
74
|
+
'error',
|
|
75
|
+
{
|
|
76
|
+
groups: [
|
|
77
|
+
'builtin',
|
|
78
|
+
'external',
|
|
79
|
+
'unknown',
|
|
80
|
+
['internal', 'parent', 'sibling', 'index'],
|
|
81
|
+
],
|
|
82
|
+
pathGroups: [
|
|
83
|
+
{
|
|
84
|
+
pattern: '$**',
|
|
85
|
+
group: 'unknown',
|
|
86
|
+
position: 'after',
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
'newlines-between': 'always',
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
'import-x/no-rename-default': 'off',
|
|
93
|
+
'import-x/no-duplicates': 'error',
|
|
94
|
+
},
|
|
95
|
+
}
|