@modern-js-app/eslint-config 1.2.4 → 1.2.7
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 +28 -0
- package/base.js +3 -310
- package/index.js +1 -1
- package/jest.config.js +0 -1
- package/package.json +4 -4
- package/ts.js +15 -10
- package/ts.withType.js +2 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @modern-js-app/eslint-config
|
|
2
2
|
|
|
3
|
+
## 1.2.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d6522e85: feat: remove max-params and max-statements rule
|
|
8
|
+
- Updated dependencies [17d0cc46]
|
|
9
|
+
- @modern-js/babel-preset-app@1.2.6
|
|
10
|
+
|
|
11
|
+
## 1.2.6
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 8e737893: feat: disable promise/prefer-await-to-then
|
|
16
|
+
- 8e737893: feat: disable require-atomic-updates
|
|
17
|
+
- a2761eb7: fix: exclude modern.config.ts from with type rules
|
|
18
|
+
- 8e737893: feat: disable no-shadow
|
|
19
|
+
- 8e737893: feat: disable @typescript-eslint/no-base-to-string
|
|
20
|
+
- 8e737893: feat: disable filenames/match-exported
|
|
21
|
+
- Updated dependencies [9d4a005b]
|
|
22
|
+
- @modern-js/babel-preset-app@1.2.5
|
|
23
|
+
|
|
24
|
+
## 1.2.5
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- 10f47286: fix: typescript eslint rule due to @typescript-eslint/eslint-plugin's breaking change
|
|
29
|
+
- 0ef81796: feat: simplify react eslint rules
|
|
30
|
+
|
|
3
31
|
## 1.2.4
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/base.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
/* eslint-disable max-lines
|
|
2
|
-
|
|
1
|
+
/* eslint-disable max-lines */
|
|
3
2
|
const { jsExtensions } = require('./utils');
|
|
4
3
|
|
|
5
4
|
module.exports = {
|
|
@@ -97,7 +96,7 @@ module.exports = {
|
|
|
97
96
|
|
|
98
97
|
/*
|
|
99
98
|
* https://eslint.org/docs/rules/no-debugger
|
|
100
|
-
* @TIPS: for non-
|
|
99
|
+
* @TIPS: for non-VS Code users, please use `debugger // eslint-disable-line`
|
|
101
100
|
* instead of `debugger` to avoid it to be removed by IDE's autoFixOnSave feature
|
|
102
101
|
*/
|
|
103
102
|
'no-debugger': 'error',
|
|
@@ -155,10 +154,6 @@ module.exports = {
|
|
|
155
154
|
'no-unsafe-finally': 'error',
|
|
156
155
|
// https://eslint.org/docs/rules/no-unsafe-negation
|
|
157
156
|
'no-unsafe-negation': 'error',
|
|
158
|
-
// https://eslint.org/docs/rules/require-atomic-updates
|
|
159
|
-
// @bug https://github.com/eslint/eslint/issues/11899
|
|
160
|
-
'require-atomic-updates': 'warn',
|
|
161
|
-
// 'require-atomic-updates': 'error',
|
|
162
157
|
// https://eslint.org/docs/rules/use-isnan
|
|
163
158
|
'use-isnan': 'error',
|
|
164
159
|
// https://eslint.org/docs/rules/valid-typeof
|
|
@@ -427,17 +422,6 @@ module.exports = {
|
|
|
427
422
|
// @CUSTOM
|
|
428
423
|
],
|
|
429
424
|
|
|
430
|
-
/*
|
|
431
|
-
* https://eslint.org/docs/rules/no-shadow
|
|
432
|
-
* "no-shadow": "off",
|
|
433
|
-
*/
|
|
434
|
-
'no-shadow': [
|
|
435
|
-
'error',
|
|
436
|
-
{
|
|
437
|
-
builtinGlobals: false,
|
|
438
|
-
allow: [],
|
|
439
|
-
},
|
|
440
|
-
],
|
|
441
425
|
// https://eslint.org/docs/rules/no-shadow-restricted-names
|
|
442
426
|
'no-shadow-restricted-names': 'error',
|
|
443
427
|
// https://eslint.org/docs/rules/no-undef
|
|
@@ -634,28 +618,11 @@ module.exports = {
|
|
|
634
618
|
skipComments: true,
|
|
635
619
|
},
|
|
636
620
|
],
|
|
637
|
-
// https://eslint.org/docs/rules/max-lines-per-function
|
|
638
|
-
'max-lines-per-function': 'off',
|
|
639
621
|
|
|
640
622
|
/*
|
|
641
|
-
* 'max-lines-per-function': [
|
|
642
|
-
* 'error',
|
|
643
|
-
* {
|
|
644
|
-
* max: 50,
|
|
645
|
-
* skipBlankLines: true,
|
|
646
|
-
* skipComments: true,
|
|
647
|
-
* IIFEs: true,
|
|
648
|
-
* },
|
|
649
|
-
* ],
|
|
650
623
|
* https://eslint.org/docs/rules/max-nested-callbacks
|
|
651
624
|
*/
|
|
652
625
|
'max-nested-callbacks': ['warn', 4],
|
|
653
|
-
// https://eslint.org/docs/rules/max-params
|
|
654
|
-
'max-params': ['warn', 4],
|
|
655
|
-
// https://eslint.org/docs/rules/max-statements
|
|
656
|
-
'max-statements': ['warn', 20],
|
|
657
|
-
// https://eslint.org/docs/rules/max-statements-per-line
|
|
658
|
-
'max-statements-per-line': ['error', { max: 1 }],
|
|
659
626
|
// https://eslint.org/docs/rules/multiline-comment-style
|
|
660
627
|
// @TODO bug:
|
|
661
628
|
// // class Foo {
|
|
@@ -1013,12 +980,6 @@ module.exports = {
|
|
|
1013
980
|
'react/button-has-type': 'error',
|
|
1014
981
|
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/default-props-match-prop-types.md
|
|
1015
982
|
'react/default-props-match-prop-types': 'error',
|
|
1016
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/destructuring-assignment.md
|
|
1017
|
-
'react/destructuring-assignment': [
|
|
1018
|
-
'error',
|
|
1019
|
-
'always',
|
|
1020
|
-
{ ignoreClassFields: true },
|
|
1021
|
-
],
|
|
1022
983
|
|
|
1023
984
|
/*
|
|
1024
985
|
* https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/display-name.md
|
|
@@ -1042,59 +1003,6 @@ module.exports = {
|
|
|
1042
1003
|
* - 嗯ok,这个规则现在的性价比是不太高了…
|
|
1043
1004
|
*/
|
|
1044
1005
|
'react/display-name': 'off',
|
|
1045
|
-
// 'react/display-name': [
|
|
1046
|
-
// 'error',
|
|
1047
|
-
// {
|
|
1048
|
-
// ignoreTranspilerName: false,
|
|
1049
|
-
// },
|
|
1050
|
-
// ],
|
|
1051
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/forbid-component-props.md
|
|
1052
|
-
'react/forbid-component-props': 'off',
|
|
1053
|
-
|
|
1054
|
-
/*
|
|
1055
|
-
* @CUSTOM
|
|
1056
|
-
* "react/forbid-component-props": [
|
|
1057
|
-
* "error",
|
|
1058
|
-
* {
|
|
1059
|
-
* "forbid": [
|
|
1060
|
-
* "className",
|
|
1061
|
-
* "style"
|
|
1062
|
-
* ]
|
|
1063
|
-
* }
|
|
1064
|
-
* ],
|
|
1065
|
-
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/forbid-dom-props.md
|
|
1066
|
-
*/
|
|
1067
|
-
'react/forbid-dom-props': 'off',
|
|
1068
|
-
|
|
1069
|
-
/*
|
|
1070
|
-
* @CUSTOM
|
|
1071
|
-
* "react/forbid-dom-props": [
|
|
1072
|
-
* "error",
|
|
1073
|
-
* {
|
|
1074
|
-
* "forbid": []
|
|
1075
|
-
* }
|
|
1076
|
-
* ],
|
|
1077
|
-
* https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/forbid-elements.md
|
|
1078
|
-
*/
|
|
1079
|
-
'react/forbid-elements': 'off',
|
|
1080
|
-
|
|
1081
|
-
/*
|
|
1082
|
-
* @CUSTOM
|
|
1083
|
-
* "react/forbid-elements": [
|
|
1084
|
-
* "error",
|
|
1085
|
-
* {
|
|
1086
|
-
* "forbid": [
|
|
1087
|
-
* {
|
|
1088
|
-
* "element": "button",
|
|
1089
|
-
* "message": "use <Button> instead"
|
|
1090
|
-
* }
|
|
1091
|
-
* ]
|
|
1092
|
-
* }
|
|
1093
|
-
* ],
|
|
1094
|
-
* https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/forbid-prop-types.md
|
|
1095
|
-
*/
|
|
1096
|
-
'react/forbid-prop-types': 'off',
|
|
1097
|
-
|
|
1098
1006
|
/*
|
|
1099
1007
|
* @CUSTOM
|
|
1100
1008
|
* "react/forbid-prop-types": [
|
|
@@ -1118,52 +1026,22 @@ module.exports = {
|
|
|
1118
1026
|
'react/no-access-state-in-setstate': 'error',
|
|
1119
1027
|
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-array-index-key.md
|
|
1120
1028
|
'react/no-array-index-key': 'warn',
|
|
1121
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-children-prop.md
|
|
1122
|
-
'react/no-children-prop': 'error',
|
|
1123
|
-
|
|
1124
1029
|
/*
|
|
1125
1030
|
* https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-danger.md
|
|
1126
1031
|
* @TIPS
|
|
1127
1032
|
* explicitly declare `eslint-disable` when truly necessary
|
|
1128
1033
|
*/
|
|
1129
1034
|
'react/no-danger': 'error',
|
|
1130
|
-
|
|
1131
|
-
/*
|
|
1132
|
-
* https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-danger-with-children.md
|
|
1133
|
-
* @TIPS
|
|
1134
|
-
* explicitly declare `eslint-disable` when truly necessary
|
|
1135
|
-
*/
|
|
1136
|
-
'react/no-danger-with-children': 'error',
|
|
1137
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-deprecated.md
|
|
1138
|
-
'react/no-deprecated': 'error',
|
|
1139
1035
|
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-did-mount-set-state.md
|
|
1140
1036
|
'react/no-did-mount-set-state': 'error',
|
|
1141
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-did-update-set-state.md
|
|
1142
|
-
'react/no-did-update-set-state': 'off',
|
|
1143
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-direct-mutation-state.md
|
|
1144
|
-
'react/no-direct-mutation-state': 'error',
|
|
1145
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-find-dom-node.md
|
|
1146
|
-
'react/no-find-dom-node': 'error',
|
|
1147
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-is-mounted.md
|
|
1148
|
-
'react/no-is-mounted': 'error',
|
|
1149
1037
|
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-multi-comp.md
|
|
1150
1038
|
'react/no-multi-comp': ['error', { ignoreStateless: true }],
|
|
1151
1039
|
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-redundant-should-component-update.md
|
|
1152
1040
|
'react/no-redundant-should-component-update': 'error',
|
|
1153
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-render-return-value.md
|
|
1154
|
-
'react/no-render-return-value': 'error',
|
|
1155
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-set-state.md
|
|
1156
|
-
'react/no-set-state': 'off',
|
|
1157
1041
|
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-typos.md
|
|
1158
1042
|
'react/no-typos': 'error',
|
|
1159
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-string-refs.md
|
|
1160
|
-
'react/no-string-refs': 'error',
|
|
1161
1043
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-this-in-sfc.md
|
|
1162
1044
|
'react/no-this-in-sfc': 'error',
|
|
1163
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-unescaped-entities.md
|
|
1164
|
-
'react/no-unescaped-entities': 'error',
|
|
1165
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-unknown-property.md
|
|
1166
|
-
'react/no-unknown-property': 'error',
|
|
1167
1045
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unsafe.md
|
|
1168
1046
|
'react/no-unsafe': ['error', { checkAliases: true }],
|
|
1169
1047
|
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/no-unused-prop-types.md
|
|
@@ -1194,14 +1072,6 @@ module.exports = {
|
|
|
1194
1072
|
{ forbidDefaultForRequired: true },
|
|
1195
1073
|
],
|
|
1196
1074
|
|
|
1197
|
-
/*
|
|
1198
|
-
* https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/require-optimization.md
|
|
1199
|
-
* https://github.com/facebook/react/pull/7195#issuecomment-236361372
|
|
1200
|
-
* https://hackernoon.com/react-purecomponent-considered-harmful-8155b5c1d4bc
|
|
1201
|
-
*/
|
|
1202
|
-
'react/require-optimization': 'off',
|
|
1203
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/require-render-return.md
|
|
1204
|
-
'react/require-render-return': 'error',
|
|
1205
1075
|
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/self-closing-comp.md
|
|
1206
1076
|
'react/self-closing-comp': [
|
|
1207
1077
|
'error',
|
|
@@ -1210,102 +1080,15 @@ module.exports = {
|
|
|
1210
1080
|
html: false,
|
|
1211
1081
|
},
|
|
1212
1082
|
],
|
|
1213
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/HEAD/docs/rules/sort-comp.md
|
|
1214
|
-
'react/sort-comp': [
|
|
1215
|
-
'error',
|
|
1216
|
-
{
|
|
1217
|
-
order: [
|
|
1218
|
-
'type-annotations',
|
|
1219
|
-
'class-properties-and-methods',
|
|
1220
|
-
'instance-variables',
|
|
1221
|
-
'state',
|
|
1222
|
-
'getInitialState',
|
|
1223
|
-
'getChildContext',
|
|
1224
|
-
'getDefaultProps',
|
|
1225
|
-
'constructor',
|
|
1226
|
-
'lifecycle',
|
|
1227
|
-
'/^is.+$/',
|
|
1228
|
-
'/^_is.+$/',
|
|
1229
|
-
'/^has.+$/',
|
|
1230
|
-
'/^_has.+$/',
|
|
1231
|
-
'/^should.+$/',
|
|
1232
|
-
'/^_should.+$/',
|
|
1233
|
-
'/^get.+$/',
|
|
1234
|
-
'/^_get.+$/',
|
|
1235
|
-
'getters',
|
|
1236
|
-
'/^set.+$/',
|
|
1237
|
-
'/^_set.+$/',
|
|
1238
|
-
'setters',
|
|
1239
|
-
'/^on.+$/',
|
|
1240
|
-
'/^_on.+$/',
|
|
1241
|
-
'/^handle.+$/',
|
|
1242
|
-
'/^_handle.+$/',
|
|
1243
|
-
'instance-methods',
|
|
1244
|
-
'everything-else',
|
|
1245
|
-
'rendering',
|
|
1246
|
-
],
|
|
1247
|
-
groups: {
|
|
1248
|
-
'class-properties-and-methods': [
|
|
1249
|
-
'displayName',
|
|
1250
|
-
'propTypes',
|
|
1251
|
-
'contextTypes',
|
|
1252
|
-
'childContextTypes',
|
|
1253
|
-
'mixins',
|
|
1254
|
-
'statics',
|
|
1255
|
-
'defaultProps',
|
|
1256
|
-
'getDerivedStateFromProps',
|
|
1257
|
-
'static-methods',
|
|
1258
|
-
],
|
|
1259
|
-
lifecycle: [
|
|
1260
|
-
'UNSAFE_componentWillMount',
|
|
1261
|
-
'componentWillMount',
|
|
1262
|
-
'componentDidMount',
|
|
1263
|
-
'UNSAFE_componentWillReceiveProps',
|
|
1264
|
-
'componentWillReceiveProps',
|
|
1265
|
-
'shouldComponentUpdate',
|
|
1266
|
-
'getSnapshotBeforeUpdate',
|
|
1267
|
-
'UNSAFE_componentWillUpdate',
|
|
1268
|
-
'componentWillUpdate',
|
|
1269
|
-
'componentDidUpdate',
|
|
1270
|
-
'componentWillUnmount',
|
|
1271
|
-
],
|
|
1272
|
-
rendering: ['/^render.+$/', 'render'],
|
|
1273
|
-
},
|
|
1274
|
-
},
|
|
1275
|
-
],
|
|
1276
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-prop-types.md
|
|
1277
|
-
'react/sort-prop-types': 'off',
|
|
1278
1083
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/style-prop-object.md
|
|
1279
1084
|
'react/style-prop-object': 'error',
|
|
1280
1085
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md
|
|
1281
1086
|
'react/void-dom-elements-no-children': 'error',
|
|
1282
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
|
|
1283
|
-
'react/jsx-boolean-value': ['error', 'always'],
|
|
1284
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-child-element-spacing.md
|
|
1285
|
-
'react/jsx-child-element-spacing': 'error',
|
|
1286
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md
|
|
1287
|
-
'react/jsx-closing-bracket-location': [
|
|
1288
|
-
'error',
|
|
1289
|
-
{
|
|
1290
|
-
// "selfClosing": "props-aligned",
|
|
1291
|
-
selfClosing: 'after-props',
|
|
1292
|
-
// "nonEmpty": "props-aligned"
|
|
1293
|
-
nonEmpty: 'after-props',
|
|
1294
|
-
},
|
|
1295
|
-
],
|
|
1296
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-tag-location.md
|
|
1297
|
-
'react/jsx-closing-tag-location': 'error',
|
|
1298
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md
|
|
1299
|
-
'react/jsx-curly-spacing': ['error', { when: 'never' }],
|
|
1300
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-equals-spacing.md
|
|
1301
|
-
'react/jsx-equals-spacing': ['error', 'never'],
|
|
1302
1087
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
|
|
1303
1088
|
'react/jsx-filename-extension': [
|
|
1304
1089
|
'error',
|
|
1305
1090
|
{ extensions: ['.jsx', '.tsx', '.mjsx', '.cjsx'] },
|
|
1306
1091
|
],
|
|
1307
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md
|
|
1308
|
-
'react/jsx-first-prop-new-line': ['error', 'multiline'],
|
|
1309
1092
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-handler-names.md
|
|
1310
1093
|
'react/jsx-handler-names': [
|
|
1311
1094
|
'error',
|
|
@@ -1315,22 +1098,6 @@ module.exports = {
|
|
|
1315
1098
|
eventHandlerPropPrefix: 'on',
|
|
1316
1099
|
},
|
|
1317
1100
|
],
|
|
1318
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md
|
|
1319
|
-
'react/jsx-indent': ['error', 2],
|
|
1320
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md
|
|
1321
|
-
'react/jsx-indent-props': ['error', 2],
|
|
1322
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-key.md
|
|
1323
|
-
'react/jsx-key': 'error',
|
|
1324
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-max-depth.md
|
|
1325
|
-
'react/jsx-max-depth': 'off',
|
|
1326
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md
|
|
1327
|
-
'react/jsx-max-props-per-line': [
|
|
1328
|
-
'error',
|
|
1329
|
-
{
|
|
1330
|
-
maximum: 1,
|
|
1331
|
-
when: 'always',
|
|
1332
|
-
},
|
|
1333
|
-
],
|
|
1334
1101
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md
|
|
1335
1102
|
'react/jsx-no-bind': [
|
|
1336
1103
|
'error',
|
|
@@ -1339,85 +1106,20 @@ module.exports = {
|
|
|
1339
1106
|
allowArrowFunctions: true,
|
|
1340
1107
|
},
|
|
1341
1108
|
],
|
|
1342
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md
|
|
1343
|
-
'react/jsx-no-comment-textnodes': 'error',
|
|
1344
1109
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-duplicate-props.md
|
|
1345
1110
|
'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }],
|
|
1346
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-literals.md
|
|
1347
|
-
'react/jsx-no-literals': 'off',
|
|
1348
1111
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-target-blank.md
|
|
1349
1112
|
'react/jsx-no-target-blank': 'off',
|
|
1350
1113
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-undef.md
|
|
1351
1114
|
'react/jsx-no-undef': ['error', { allowGlobals: true }],
|
|
1352
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-one-expression-per-line.md
|
|
1353
|
-
'react/jsx-one-expression-per-line': ['error', { allow: 'single-child' }],
|
|
1354
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-brace-presence.md
|
|
1355
|
-
'react/jsx-curly-brace-presence': 'off',
|
|
1356
|
-
|
|
1357
|
-
/*
|
|
1358
|
-
* "react/jsx-curly-brace-presence": [
|
|
1359
|
-
* "error",
|
|
1360
|
-
* "never"
|
|
1361
|
-
* ],
|
|
1362
|
-
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-fragments.md
|
|
1363
|
-
* @TODO bug
|
|
1364
|
-
*/
|
|
1365
|
-
'react/jsx-fragments': 'off', // ['error', 'syntax'],
|
|
1366
1115
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-pascal-case.md
|
|
1367
1116
|
'react/jsx-pascal-case': 'error',
|
|
1368
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-multi-spaces.md
|
|
1369
|
-
'react/jsx-props-no-multi-spaces': 'error',
|
|
1370
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-default-props.md
|
|
1371
|
-
'react/jsx-sort-default-props': 'off',
|
|
1372
|
-
|
|
1373
|
-
/*
|
|
1374
|
-
* https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-sort-props.md
|
|
1375
|
-
* @TODO bug: conflict with prettier
|
|
1376
|
-
*/
|
|
1377
|
-
'react/jsx-sort-props': 'off',
|
|
1378
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-tag-spacing.md
|
|
1379
|
-
'react/jsx-tag-spacing': [
|
|
1380
|
-
'error',
|
|
1381
|
-
{
|
|
1382
|
-
closingSlash: 'never',
|
|
1383
|
-
beforeSelfClosing: 'always',
|
|
1384
|
-
afterOpening: 'never',
|
|
1385
|
-
beforeClosing: 'never',
|
|
1386
|
-
},
|
|
1387
|
-
],
|
|
1388
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-react.md
|
|
1389
|
-
// react 17
|
|
1390
|
-
'react/jsx-uses-react': 'error',
|
|
1391
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-uses-vars.md
|
|
1392
|
-
'react/jsx-uses-vars': 'error',
|
|
1393
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-wrap-multilines.md
|
|
1394
|
-
'react/jsx-wrap-multilines': [
|
|
1395
|
-
'error',
|
|
1396
|
-
{
|
|
1397
|
-
declaration: true,
|
|
1398
|
-
assignment: true,
|
|
1399
|
-
return: true,
|
|
1400
|
-
arrow: true,
|
|
1401
|
-
condition: 'parens-new-line',
|
|
1402
|
-
logical: 'parens-new-line',
|
|
1403
|
-
prop: 'parens-new-line',
|
|
1404
|
-
},
|
|
1405
|
-
],
|
|
1406
1117
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-unused-state.md
|
|
1407
1118
|
'react/no-unused-state': 'error',
|
|
1408
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-props-no-spreading.md
|
|
1409
|
-
'react/jsx-props-no-spreading': 'off',
|
|
1410
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-read-only-props.md
|
|
1411
|
-
'react/prefer-read-only-props': 'off',
|
|
1412
1119
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/state-in-constructor.md
|
|
1413
1120
|
'react/state-in-constructor': ['error', 'never'],
|
|
1414
1121
|
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/static-property-placement.md
|
|
1415
1122
|
'react/static-property-placement': 'error',
|
|
1416
|
-
// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-newline.md
|
|
1417
|
-
'react/jsx-curly-newline': [
|
|
1418
|
-
'error',
|
|
1419
|
-
{ multiline: 'require', singleline: 'forbid' },
|
|
1420
|
-
],
|
|
1421
1123
|
// https://reactjs.org/docs/hooks-rules.html
|
|
1422
1124
|
'react-hooks/rules-of-hooks': 'error',
|
|
1423
1125
|
// https://github.com/facebook/react/issues/16006
|
|
@@ -1628,8 +1330,6 @@ module.exports = {
|
|
|
1628
1330
|
* use Camel Case for others
|
|
1629
1331
|
*/
|
|
1630
1332
|
'filenames/match-regex': ['error', '^[\\[\\]_a-zA-Z0-9.-]+$'],
|
|
1631
|
-
// https://www.npmjs.com/package/eslint-plugin-filenames#matching-exported-values-match-exported
|
|
1632
|
-
'filenames/match-exported': ['error', ['kebab', 'camel', 'pascal']],
|
|
1633
1333
|
// https://www.npmjs.com/package/eslint-plugin-filenames#dont-allow-indexjs-files-no-index
|
|
1634
1334
|
'filenames/no-index': 'off',
|
|
1635
1335
|
|
|
@@ -1659,12 +1359,6 @@ module.exports = {
|
|
|
1659
1359
|
// https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/valid-params.md
|
|
1660
1360
|
'promise/valid-params': 'error',
|
|
1661
1361
|
|
|
1662
|
-
/*
|
|
1663
|
-
* https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/prefer-await-to-then.md
|
|
1664
|
-
* @CUSTOM
|
|
1665
|
-
*/
|
|
1666
|
-
'promise/prefer-await-to-then': 'error',
|
|
1667
|
-
|
|
1668
1362
|
/*
|
|
1669
1363
|
* https://github.com/xjamundx/eslint-plugin-promise/blob/master/docs/rules/prefer-await-to-callbacks.md
|
|
1670
1364
|
* @CUSTOM
|
|
@@ -1829,7 +1523,6 @@ module.exports = {
|
|
|
1829
1523
|
files: ['**/pages/**/_*', '**/pages/**/index.*', '**/pages/**/\\[**'],
|
|
1830
1524
|
rules: {
|
|
1831
1525
|
'filenames/match-regex': 'off',
|
|
1832
|
-
'filenames/match-exported': 'off',
|
|
1833
1526
|
},
|
|
1834
1527
|
},
|
|
1835
1528
|
{
|
|
@@ -1849,4 +1542,4 @@ module.exports = {
|
|
|
1849
1542
|
},
|
|
1850
1543
|
],
|
|
1851
1544
|
};
|
|
1852
|
-
/* eslint-enable max-lines
|
|
1545
|
+
/* eslint-enable max-lines */
|
package/index.js
CHANGED
package/jest.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modern-js-app/eslint-config",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"description": "The meta-framework suite designed from scratch for frontend-focused modern web development.",
|
|
5
5
|
"homepage": "https://modernjs.dev",
|
|
6
6
|
"bugs": "https://github.com/modern-js-dev/modern.js/issues",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"@babel/eslint-parser": "^7.15.0",
|
|
17
17
|
"@babel/eslint-plugin": "^7.13.10",
|
|
18
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
19
|
-
"@typescript-eslint/parser": "^5.
|
|
18
|
+
"@typescript-eslint/eslint-plugin": "^5.17.0",
|
|
19
|
+
"@typescript-eslint/parser": "^5.17.0",
|
|
20
20
|
"eslint": "^7.32.0",
|
|
21
21
|
"eslint-config-prettier": "^8.3.0",
|
|
22
22
|
"eslint-import-resolver-webpack": "^0.13.1",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"prettier": "^2.5.1"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@modern-js/babel-preset-app": "^1.2.
|
|
35
|
+
"@modern-js/babel-preset-app": "^1.2.6"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"eslint": "^7.32.0",
|
package/ts.js
CHANGED
|
@@ -165,7 +165,21 @@ module.exports = {
|
|
|
165
165
|
leadingUnderscore: 'allowSingleOrDouble',
|
|
166
166
|
trailingUnderscore: 'allowSingleOrDouble',
|
|
167
167
|
},
|
|
168
|
-
|
|
168
|
+
// https://typescript-eslint.io/rules/naming-convention/#ignore-properties-that-require-quotes
|
|
169
|
+
{
|
|
170
|
+
selector: [
|
|
171
|
+
'classProperty',
|
|
172
|
+
'objectLiteralProperty',
|
|
173
|
+
'typeProperty',
|
|
174
|
+
'classMethod',
|
|
175
|
+
'objectLiteralMethod',
|
|
176
|
+
'typeMethod',
|
|
177
|
+
'accessor',
|
|
178
|
+
'enumMember',
|
|
179
|
+
],
|
|
180
|
+
format: null,
|
|
181
|
+
modifiers: ['requiresQuotes'],
|
|
182
|
+
},
|
|
169
183
|
{
|
|
170
184
|
selector: 'variable',
|
|
171
185
|
format: ['camelCase', 'PascalCase', 'UPPER_CASE', 'snake_case'],
|
|
@@ -376,15 +390,6 @@ module.exports = {
|
|
|
376
390
|
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-redeclare.md
|
|
377
391
|
'no-redeclare': 'off',
|
|
378
392
|
'@typescript-eslint/no-redeclare': ['error', { builtinGlobals: true }],
|
|
379
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
|
|
380
|
-
'no-shadow': 'off',
|
|
381
|
-
'@typescript-eslint/no-shadow': [
|
|
382
|
-
'error',
|
|
383
|
-
{
|
|
384
|
-
builtinGlobals: false,
|
|
385
|
-
allow: [],
|
|
386
|
-
},
|
|
387
|
-
],
|
|
388
393
|
|
|
389
394
|
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/space-before-function-paren.md
|
|
390
395
|
'space-before-function-paren': 'off',
|
package/ts.withType.js
CHANGED
|
@@ -2,7 +2,8 @@ module.exports = {
|
|
|
2
2
|
overrides: [
|
|
3
3
|
{
|
|
4
4
|
files: ['*.ts', '*.d.ts', '*.tsx'],
|
|
5
|
-
|
|
5
|
+
// modern.config.ts is usually not included in tsconfig.json
|
|
6
|
+
excludedFiles: ['modern.config.ts'],
|
|
6
7
|
parserOptions: {
|
|
7
8
|
ecmaFeatures: { jsx: true },
|
|
8
9
|
// don't set tsconfigRootDir, using the path relative to the cwd
|
|
@@ -23,11 +24,6 @@ module.exports = {
|
|
|
23
24
|
],
|
|
24
25
|
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md
|
|
25
26
|
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
|
26
|
-
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/restrict-template-expressions.md
|
|
27
|
-
'@typescript-eslint/restrict-template-expressions': [
|
|
28
|
-
'error',
|
|
29
|
-
{ allowNumber: true, allowAny: true },
|
|
30
|
-
],
|
|
31
27
|
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-base-to-string.md
|
|
32
28
|
'@typescript-eslint/no-base-to-string': 'error',
|
|
33
29
|
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md
|