@aiou/eslint-config 2.0.3 → 2.1.0

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/dist/index.cjs CHANGED
@@ -63,7 +63,7 @@ const comments = () => {
63
63
  "eslint-comments": pluginComments__default.default
64
64
  },
65
65
  rules: {
66
- "eslint-comments/disable-enable-pair": "error",
66
+ "eslint-comments/disable-enable-pair": "off",
67
67
  "eslint-comments/no-aggregating-enable": "error",
68
68
  "eslint-comments/no-duplicate-disable": "error",
69
69
  "eslint-comments/no-unlimited-disable": "error",
@@ -154,7 +154,15 @@ const imports = () => {
154
154
  "unused-imports/no-unused-imports": "error",
155
155
  "unused-imports/no-unused-vars": [
156
156
  "warn",
157
- { vars: "all", varsIgnorePattern: "^_", args: "after-used", argsIgnorePattern: "^_" }
157
+ {
158
+ // https://github.com/sweepline/eslint-plugin-unused-imports/issues/105
159
+ caughtErrors: "all",
160
+ caughtErrorsIgnorePattern: "^_",
161
+ vars: "all",
162
+ varsIgnorePattern: "^_",
163
+ args: "after-used",
164
+ argsIgnorePattern: "^_"
165
+ }
158
166
  ],
159
167
  // Enforce newlines inside named import
160
168
  "import-newlines/enforce": [
@@ -295,22 +303,7 @@ const javascript = () => {
295
303
  // "eqeqeq": ["error", "always", { "null": "ignore" }],
296
304
  "func-call-spacing": ["error", "never"],
297
305
  "generator-star-spacing": ["error", { before: true, after: true }],
298
- indent: ["error", 2, {
299
- SwitchCase: 1,
300
- VariableDeclarator: 1,
301
- outerIIFEBody: 1,
302
- MemberExpression: 1,
303
- FunctionDeclaration: { parameters: 1, body: 1 },
304
- FunctionExpression: { parameters: 1, body: 1 },
305
- CallExpression: { arguments: 1 },
306
- ArrayExpression: 1,
307
- ObjectExpression: 1,
308
- ImportDeclaration: 1,
309
- flatTernaryExpressions: false,
310
- ignoreComments: false,
311
- ignoredNodes: ["TemplateLiteral *", "JSXElement", "JSXElement > *", "JSXAttribute", "JSXIdentifier", "JSXNamespacedName", "JSXMemberExpression", "JSXSpreadAttribute", "JSXExpressionContainer", "JSXOpeningElement", "JSXClosingElement", "JSXFragment", "JSXOpeningFragment", "JSXClosingFragment", "JSXText", "JSXEmptyExpression", "JSXSpreadChild"],
312
- offsetTernaryExpressions: true
313
- }],
306
+ indent: "off",
314
307
  "key-spacing": ["error", { beforeColon: false, afterColon: true }],
315
308
  "keyword-spacing": ["error", { before: true, after: true }],
316
309
  "lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
@@ -473,7 +466,7 @@ const javascript = () => {
473
466
  "promise/param-names": "error",
474
467
  "promise/no-new-statics": "error",
475
468
  "promise/no-multiple-resolved": "error",
476
- "promise/prefer-await-to-then": "warn",
469
+ "promise/prefer-await-to-then": "off",
477
470
  // override
478
471
  curly: ["error", "all"],
479
472
  "no-unused-vars": "warn",
@@ -545,6 +538,7 @@ const jsonc = () => {
545
538
  {
546
539
  files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
547
540
  ignores: [GLOB_CLAUDE_JSON],
541
+ name: "jsonc/setup",
548
542
  languageOptions: {
549
543
  parser: jsoncParser__default.default
550
544
  },
@@ -554,6 +548,7 @@ const jsonc = () => {
554
548
  },
555
549
  {
556
550
  files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
551
+ ignores: [GLOB_CLAUDE_JSON],
557
552
  rules: {
558
553
  ...pluginJsonc__default.default.configs["recommended-with-jsonc"].rules,
559
554
  // refs: https://ota-meshi.github.io/eslint-plugin-jsonc/rules/indent.html
@@ -897,7 +892,8 @@ const react = () => {
897
892
  "react-dom/no-unknown-property": "off",
898
893
  "react/avoid-shorthand-boolean": ["error"],
899
894
  // https://github.com/ArnaudBarre/eslint-plugin-react-refresh
900
- "react-refresh/only-export-components": "warn"
895
+ "react-refresh/only-export-components": "warn",
896
+ "react-hooks-extra/no-direct-set-state-in-use-effect": "off"
901
897
  }
902
898
  },
903
899
  {
@@ -1061,7 +1057,7 @@ const stylistic = () => {
1061
1057
  rules: {
1062
1058
  ...off,
1063
1059
  ...config.rules,
1064
- "@stylistic/quotes": ["error", "single"],
1060
+ "@stylistic/quotes": ["error", "single", { avoidEscape: true }],
1065
1061
  "@stylistic/quote-props": ["error", "as-needed"],
1066
1062
  "@stylistic/array-bracket-spacing": ["error", "never"],
1067
1063
  // https://eslint.org/docs/latest/rules/brace-style#1tbs
@@ -1072,6 +1068,7 @@ const stylistic = () => {
1072
1068
  "comma-dangle": "off",
1073
1069
  "@stylistic/comma-dangle": ["error", "always-multiline"],
1074
1070
  "@stylistic/key-spacing": ["error", { beforeColon: false, afterColon: true }],
1071
+ "@stylistic/multiline-ternary": ["error", "always-multiline"],
1075
1072
  "@stylistic/indent": ["error", 2, {
1076
1073
  SwitchCase: 1,
1077
1074
  VariableDeclarator: 1,
@@ -1083,7 +1080,7 @@ const stylistic = () => {
1083
1080
  ArrayExpression: 1,
1084
1081
  ObjectExpression: 1,
1085
1082
  ImportDeclaration: 1,
1086
- flatTernaryExpressions: false,
1083
+ flatTernaryExpressions: true,
1087
1084
  ignoreComments: false,
1088
1085
  ignoredNodes: [
1089
1086
  "TemplateLiteral *",
@@ -1218,7 +1215,7 @@ const typescript = () => {
1218
1215
  "@typescript-eslint/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
1219
1216
  "@typescript-eslint/consistent-type-imports": [
1220
1217
  "error",
1221
- { prefer: "type-imports", disallowTypeAnnotations: false }
1218
+ { prefer: "type-imports", disallowTypeAnnotations: false, fixStyle: "separate-type-imports" }
1222
1219
  ],
1223
1220
  // Limit `interface` define object types, users could override with *.d.ts declare
1224
1221
  "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
@@ -1232,8 +1229,6 @@ const typescript = () => {
1232
1229
  // use createRequire instead
1233
1230
  "@typescript-eslint/no-require-imports": "error",
1234
1231
  "@typescript-eslint/no-empty-object-type": "off",
1235
- // https://www.npmjs.com/package/eslint-plugin-etc
1236
- "etc/no-t": "error",
1237
1232
  /**
1238
1233
  * refs:
1239
1234
  * 1. https://ncjamieson.com/dont-export-const-enums/
@@ -1249,15 +1244,21 @@ const typescript = () => {
1249
1244
  message: "Don't declare enums"
1250
1245
  }
1251
1246
  ],
1247
+ "@typescript-eslint/method-signature-style": ["error", "property"],
1248
+ // https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful,
1249
+ "@typescript-eslint/no-import-type-side-effects": "error",
1250
+ "@typescript-eslint/no-wrapper-object-types": "error",
1251
+ // https://www.npmjs.com/package/eslint-plugin-etc
1252
+ "etc/no-t": "error",
1252
1253
  // required tsconfig.json
1253
- // 'etc/no-misused-generics': 'error',
1254
+ // 'etc/no-misused-generics'f: 'error',
1254
1255
  // Overrides JS
1255
1256
  // original no-undef not compatiable with typescript
1256
1257
  // refs: https://typescript-eslint.io/linting/troubleshooting/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
1257
1258
  "no-undef": "off",
1258
1259
  "no-unused-vars": "off",
1259
1260
  "no-redeclare": "off",
1260
- "@typescript-eslint/no-redeclare": "error",
1261
+ "@typescript-eslint/no-redeclare": ["error", { builtinGlobals: false }],
1261
1262
  "no-dupe-class-members": "off",
1262
1263
  "@typescript-eslint/no-dupe-class-members": "error",
1263
1264
  "no-use-before-define": "off",
@@ -1267,6 +1268,12 @@ const typescript = () => {
1267
1268
  ],
1268
1269
  "no-loss-of-precision": "off",
1269
1270
  "@typescript-eslint/no-loss-of-precision": "error",
1271
+ "no-unused-expressions": "off",
1272
+ "@typescript-eslint/no-unused-expressions": ["error", {
1273
+ allowShortCircuit: true,
1274
+ allowTernary: true,
1275
+ allowTaggedTemplates: true
1276
+ }],
1270
1277
  // off
1271
1278
  "@typescript-eslint/camelcase": "off",
1272
1279
  "@typescript-eslint/explicit-function-return-type": "off",
@@ -1283,7 +1290,11 @@ const typescript = () => {
1283
1290
  "@typescript-eslint/no-var-requires": "off",
1284
1291
  // https://www.npmjs.com/package/eslint-plugin-unused-imports
1285
1292
  "@typescript-eslint/no-unused-vars": "off",
1286
- "no-void": ["error", { allowAsStatement: true }]
1293
+ "no-void": ["error", { allowAsStatement: true }],
1294
+ "@typescript-eslint/no-dynamic-delete": "off",
1295
+ "@typescript-eslint/no-extraneous-class": "off",
1296
+ "@typescript-eslint/no-useless-constructor": "off",
1297
+ "@typescript-eslint/triple-slash-reference": "off"
1287
1298
  }
1288
1299
  },
1289
1300
  {
package/dist/index.mjs CHANGED
@@ -34,7 +34,7 @@ const comments = () => {
34
34
  "eslint-comments": pluginComments
35
35
  },
36
36
  rules: {
37
- "eslint-comments/disable-enable-pair": "error",
37
+ "eslint-comments/disable-enable-pair": "off",
38
38
  "eslint-comments/no-aggregating-enable": "error",
39
39
  "eslint-comments/no-duplicate-disable": "error",
40
40
  "eslint-comments/no-unlimited-disable": "error",
@@ -125,7 +125,15 @@ const imports = () => {
125
125
  "unused-imports/no-unused-imports": "error",
126
126
  "unused-imports/no-unused-vars": [
127
127
  "warn",
128
- { vars: "all", varsIgnorePattern: "^_", args: "after-used", argsIgnorePattern: "^_" }
128
+ {
129
+ // https://github.com/sweepline/eslint-plugin-unused-imports/issues/105
130
+ caughtErrors: "all",
131
+ caughtErrorsIgnorePattern: "^_",
132
+ vars: "all",
133
+ varsIgnorePattern: "^_",
134
+ args: "after-used",
135
+ argsIgnorePattern: "^_"
136
+ }
129
137
  ],
130
138
  // Enforce newlines inside named import
131
139
  "import-newlines/enforce": [
@@ -266,22 +274,7 @@ const javascript = () => {
266
274
  // "eqeqeq": ["error", "always", { "null": "ignore" }],
267
275
  "func-call-spacing": ["error", "never"],
268
276
  "generator-star-spacing": ["error", { before: true, after: true }],
269
- indent: ["error", 2, {
270
- SwitchCase: 1,
271
- VariableDeclarator: 1,
272
- outerIIFEBody: 1,
273
- MemberExpression: 1,
274
- FunctionDeclaration: { parameters: 1, body: 1 },
275
- FunctionExpression: { parameters: 1, body: 1 },
276
- CallExpression: { arguments: 1 },
277
- ArrayExpression: 1,
278
- ObjectExpression: 1,
279
- ImportDeclaration: 1,
280
- flatTernaryExpressions: false,
281
- ignoreComments: false,
282
- ignoredNodes: ["TemplateLiteral *", "JSXElement", "JSXElement > *", "JSXAttribute", "JSXIdentifier", "JSXNamespacedName", "JSXMemberExpression", "JSXSpreadAttribute", "JSXExpressionContainer", "JSXOpeningElement", "JSXClosingElement", "JSXFragment", "JSXOpeningFragment", "JSXClosingFragment", "JSXText", "JSXEmptyExpression", "JSXSpreadChild"],
283
- offsetTernaryExpressions: true
284
- }],
277
+ indent: "off",
285
278
  "key-spacing": ["error", { beforeColon: false, afterColon: true }],
286
279
  "keyword-spacing": ["error", { before: true, after: true }],
287
280
  "lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
@@ -444,7 +437,7 @@ const javascript = () => {
444
437
  "promise/param-names": "error",
445
438
  "promise/no-new-statics": "error",
446
439
  "promise/no-multiple-resolved": "error",
447
- "promise/prefer-await-to-then": "warn",
440
+ "promise/prefer-await-to-then": "off",
448
441
  // override
449
442
  curly: ["error", "all"],
450
443
  "no-unused-vars": "warn",
@@ -516,6 +509,7 @@ const jsonc = () => {
516
509
  {
517
510
  files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
518
511
  ignores: [GLOB_CLAUDE_JSON],
512
+ name: "jsonc/setup",
519
513
  languageOptions: {
520
514
  parser: jsoncParser
521
515
  },
@@ -525,6 +519,7 @@ const jsonc = () => {
525
519
  },
526
520
  {
527
521
  files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
522
+ ignores: [GLOB_CLAUDE_JSON],
528
523
  rules: {
529
524
  ...pluginJsonc.configs["recommended-with-jsonc"].rules,
530
525
  // refs: https://ota-meshi.github.io/eslint-plugin-jsonc/rules/indent.html
@@ -868,7 +863,8 @@ const react = () => {
868
863
  "react-dom/no-unknown-property": "off",
869
864
  "react/avoid-shorthand-boolean": ["error"],
870
865
  // https://github.com/ArnaudBarre/eslint-plugin-react-refresh
871
- "react-refresh/only-export-components": "warn"
866
+ "react-refresh/only-export-components": "warn",
867
+ "react-hooks-extra/no-direct-set-state-in-use-effect": "off"
872
868
  }
873
869
  },
874
870
  {
@@ -1032,7 +1028,7 @@ const stylistic = () => {
1032
1028
  rules: {
1033
1029
  ...off,
1034
1030
  ...config.rules,
1035
- "@stylistic/quotes": ["error", "single"],
1031
+ "@stylistic/quotes": ["error", "single", { avoidEscape: true }],
1036
1032
  "@stylistic/quote-props": ["error", "as-needed"],
1037
1033
  "@stylistic/array-bracket-spacing": ["error", "never"],
1038
1034
  // https://eslint.org/docs/latest/rules/brace-style#1tbs
@@ -1043,6 +1039,7 @@ const stylistic = () => {
1043
1039
  "comma-dangle": "off",
1044
1040
  "@stylistic/comma-dangle": ["error", "always-multiline"],
1045
1041
  "@stylistic/key-spacing": ["error", { beforeColon: false, afterColon: true }],
1042
+ "@stylistic/multiline-ternary": ["error", "always-multiline"],
1046
1043
  "@stylistic/indent": ["error", 2, {
1047
1044
  SwitchCase: 1,
1048
1045
  VariableDeclarator: 1,
@@ -1054,7 +1051,7 @@ const stylistic = () => {
1054
1051
  ArrayExpression: 1,
1055
1052
  ObjectExpression: 1,
1056
1053
  ImportDeclaration: 1,
1057
- flatTernaryExpressions: false,
1054
+ flatTernaryExpressions: true,
1058
1055
  ignoreComments: false,
1059
1056
  ignoredNodes: [
1060
1057
  "TemplateLiteral *",
@@ -1189,7 +1186,7 @@ const typescript = () => {
1189
1186
  "@typescript-eslint/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
1190
1187
  "@typescript-eslint/consistent-type-imports": [
1191
1188
  "error",
1192
- { prefer: "type-imports", disallowTypeAnnotations: false }
1189
+ { prefer: "type-imports", disallowTypeAnnotations: false, fixStyle: "separate-type-imports" }
1193
1190
  ],
1194
1191
  // Limit `interface` define object types, users could override with *.d.ts declare
1195
1192
  "@typescript-eslint/consistent-type-definitions": ["error", "interface"],
@@ -1203,8 +1200,6 @@ const typescript = () => {
1203
1200
  // use createRequire instead
1204
1201
  "@typescript-eslint/no-require-imports": "error",
1205
1202
  "@typescript-eslint/no-empty-object-type": "off",
1206
- // https://www.npmjs.com/package/eslint-plugin-etc
1207
- "etc/no-t": "error",
1208
1203
  /**
1209
1204
  * refs:
1210
1205
  * 1. https://ncjamieson.com/dont-export-const-enums/
@@ -1220,15 +1215,21 @@ const typescript = () => {
1220
1215
  message: "Don't declare enums"
1221
1216
  }
1222
1217
  ],
1218
+ "@typescript-eslint/method-signature-style": ["error", "property"],
1219
+ // https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful,
1220
+ "@typescript-eslint/no-import-type-side-effects": "error",
1221
+ "@typescript-eslint/no-wrapper-object-types": "error",
1222
+ // https://www.npmjs.com/package/eslint-plugin-etc
1223
+ "etc/no-t": "error",
1223
1224
  // required tsconfig.json
1224
- // 'etc/no-misused-generics': 'error',
1225
+ // 'etc/no-misused-generics'f: 'error',
1225
1226
  // Overrides JS
1226
1227
  // original no-undef not compatiable with typescript
1227
1228
  // refs: https://typescript-eslint.io/linting/troubleshooting/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
1228
1229
  "no-undef": "off",
1229
1230
  "no-unused-vars": "off",
1230
1231
  "no-redeclare": "off",
1231
- "@typescript-eslint/no-redeclare": "error",
1232
+ "@typescript-eslint/no-redeclare": ["error", { builtinGlobals: false }],
1232
1233
  "no-dupe-class-members": "off",
1233
1234
  "@typescript-eslint/no-dupe-class-members": "error",
1234
1235
  "no-use-before-define": "off",
@@ -1238,6 +1239,12 @@ const typescript = () => {
1238
1239
  ],
1239
1240
  "no-loss-of-precision": "off",
1240
1241
  "@typescript-eslint/no-loss-of-precision": "error",
1242
+ "no-unused-expressions": "off",
1243
+ "@typescript-eslint/no-unused-expressions": ["error", {
1244
+ allowShortCircuit: true,
1245
+ allowTernary: true,
1246
+ allowTaggedTemplates: true
1247
+ }],
1241
1248
  // off
1242
1249
  "@typescript-eslint/camelcase": "off",
1243
1250
  "@typescript-eslint/explicit-function-return-type": "off",
@@ -1254,7 +1261,11 @@ const typescript = () => {
1254
1261
  "@typescript-eslint/no-var-requires": "off",
1255
1262
  // https://www.npmjs.com/package/eslint-plugin-unused-imports
1256
1263
  "@typescript-eslint/no-unused-vars": "off",
1257
- "no-void": ["error", { allowAsStatement: true }]
1264
+ "no-void": ["error", { allowAsStatement: true }],
1265
+ "@typescript-eslint/no-dynamic-delete": "off",
1266
+ "@typescript-eslint/no-extraneous-class": "off",
1267
+ "@typescript-eslint/no-useless-constructor": "off",
1268
+ "@typescript-eslint/triple-slash-reference": "off"
1258
1269
  }
1259
1270
  },
1260
1271
  {
package/dts/typegen.d.ts CHANGED
@@ -7937,5 +7937,5 @@ type YmlSpacedComment = [] | [("always" | "never")] | [
7937
7937
  markers?: string[];
7938
7938
  }
7939
7939
  ];
7940
- export type ConfigNames = 'markdown/recommended/plugin' | 'markdown/recommended/processor' | 'markdown/recommended/code-blocks' | 'tailwindcss:base' | 'tailwindcss:rules';
7940
+ export type ConfigNames = 'markdown/recommended/plugin' | 'markdown/recommended/processor' | 'markdown/recommended/code-blocks' | 'jsonc/setup' | 'tailwindcss:base' | 'tailwindcss:rules';
7941
7941
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiou/eslint-config",
3
- "version": "2.0.3",
3
+ "version": "2.1.0",
4
4
  "type": "module",
5
5
  "description": "eslint config for JW",
6
6
  "keywords": [],