@aiou/eslint-config 1.0.6 → 1.2.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/README.md CHANGED
@@ -33,6 +33,14 @@ const { aiou } = require('@aiou/eslint-config')
33
33
 
34
34
  module.exports = aiou()
35
35
  ```
36
+
37
+ ### options
38
+
39
+ #### `options.ssr`
40
+
41
+ - default: `false`
42
+
43
+ enabled ssr-friendly rules
36
44
 
37
45
  ## rules
38
46
 
@@ -54,10 +62,11 @@ eslint-plugin-promise
54
62
  eslint-plugin-unicorn
55
63
  eslint-plugin-yml
56
64
  eslint-plugin-react
57
- eslint-plugin-ssr-friendly
65
+ eslint-plugin-ssr-friendly (configured when ssr enabled)
58
66
  eslint-plugin-react-refresh
59
67
  @next/eslint-plugin-next (enabled when next found)
60
68
  eslint-plugin-react-hooks
61
69
  eslint-plugin-tailwindcss
62
70
  @typescript-eslint/eslint-plugin
71
+ @stylistic/eslint-plugin
63
72
  ```
package/dist/index.cjs CHANGED
@@ -9,7 +9,6 @@ var pluginSimpleImportSort = require('eslint-plugin-simple-import-sort');
9
9
  var pluginUnsedImports = require('eslint-plugin-unused-imports');
10
10
  var pluginN = require('eslint-plugin-n');
11
11
  var pluginPromise = require('eslint-plugin-promise');
12
- var pluginRegexp = require('eslint-plugin-regexp');
13
12
  var globals$1 = require('globals');
14
13
  var pluginJsonc = require('eslint-plugin-jsonc');
15
14
  var jsoncParser = require('jsonc-eslint-parser');
@@ -20,6 +19,8 @@ var pluginReact = require('eslint-plugin-react');
20
19
  var pluginReactHooks = require('eslint-plugin-react-hooks');
21
20
  var pluginReactRefresh = require('eslint-plugin-react-refresh');
22
21
  var pluginSSRFriendly = require('eslint-plugin-ssr-friendly');
22
+ var pluginRegexp = require('eslint-plugin-regexp');
23
+ var pluginStylistic = require('@stylistic/eslint-plugin');
23
24
  var node_module = require('node:module');
24
25
  var pluginTypeScript = require('@typescript-eslint/eslint-plugin');
25
26
  var tsParser = require('@typescript-eslint/parser');
@@ -58,6 +59,7 @@ const GLOB_TEST_DIRS = "**/{test,tests,e2e,__test__,__tests__}/**";
58
59
  const GLOB_DTS = "**/*.d.ts";
59
60
  const GLOB_TS = "**/*.?([cm])ts";
60
61
  const GLOB_TSX = "**/*.?([cm])tsx";
62
+ const GLOB_JS = "**/*.?([cm])js";
61
63
  const GLOB_JSX = "**/*.?([cm])jsx";
62
64
  const GLOB_JSON = "**/*.json";
63
65
  const GLOB_JSON5 = "**/*.json5";
@@ -123,7 +125,7 @@ const imports = () => {
123
125
  "import-newlines/enforce": [
124
126
  "error",
125
127
  {
126
- items: 4,
128
+ items: 2,
127
129
  "max-len": 120,
128
130
  semi: false
129
131
  }
@@ -153,7 +155,9 @@ const imports = () => {
153
155
  `**/App*.${GLOB_SCRIPT_EXT}`,
154
156
  `**/Document.${GLOB_SCRIPT_EXT}`,
155
157
  "**/{vite,esbuild,rollup,webpack,rspack}.ts",
156
- GLOB_DTS
158
+ GLOB_DTS,
159
+ GLOB_TEST_SCRIPT,
160
+ GLOB_TEST_DIRS
157
161
  ],
158
162
  rules: {
159
163
  // related: https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/docs/TROUBLESHOOTING.md#edits-always-lead-to-full-reload
@@ -834,45 +838,25 @@ const javascript = () => {
834
838
  },
835
839
  plugins: {
836
840
  n: pluginN,
837
- promise: pluginPromise,
838
- regexp: pluginRegexp
841
+ promise: pluginPromise
839
842
  },
840
843
  rules: {
841
844
  ...pluginStandard.rules,
842
- ...pluginRegexp.configs.recommended.rules,
843
- // Common
844
- semi: ["error", "never"],
845
- // Always need {}
846
845
  curly: ["error", "all"],
847
- quotes: ["error", "single"],
848
- "quote-props": ["error", "as-needed"],
849
846
  "no-unused-vars": "warn",
850
847
  "no-param-reassign": "off",
851
- "array-bracket-spacing": ["error", "never"],
852
- // https://eslint.org/docs/latest/rules/brace-style#1tbs
853
- "brace-style": ["error", "1tbs"],
854
- "block-spacing": ["error", "always"],
855
848
  camelcase: "off",
856
- "comma-spacing": ["error", { before: false, after: true }],
857
- "comma-style": ["error", "last"],
858
- "comma-dangle": ["error", "always-multiline"],
859
849
  "no-constant-condition": "warn",
860
850
  "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off",
861
851
  "no-console": process.env.NODE_ENV === "production" ? "error" : "off",
862
852
  "no-cond-assign": ["error", "always"],
863
- "func-call-spacing": ["off", "never"],
864
- "key-spacing": ["error", { beforeColon: false, afterColon: true }],
865
- // https://github.com/prettier/prettier-eslint/issues/226
866
- indent: ["error", 2, { SwitchCase: 1, VariableDeclarator: 1, outerIIFEBody: 1 }],
867
853
  "no-restricted-syntax": [
868
854
  "error",
869
855
  "DebuggerStatement",
870
856
  "LabeledStatement",
871
857
  "WithStatement"
872
858
  ],
873
- "object-curly-spacing": ["error", "always"],
874
859
  "no-return-await": "off",
875
- "space-before-function-paren": ["error", "never"],
876
860
  // es6
877
861
  "no-var": "error",
878
862
  "prefer-const": [
@@ -901,9 +885,7 @@ const javascript = () => {
901
885
  "prefer-rest-params": "error",
902
886
  "prefer-spread": "error",
903
887
  "prefer-template": "error",
904
- "template-curly-spacing": "error",
905
888
  "arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
906
- "generator-star-spacing": "off",
907
889
  // best-practice
908
890
  "array-callback-return": "error",
909
891
  "block-scoped-var": "error",
@@ -912,15 +894,13 @@ const javascript = () => {
912
894
  eqeqeq: ["error", "allow-null"],
913
895
  "no-alert": "warn",
914
896
  "no-case-declarations": "error",
915
- "no-multi-spaces": "error",
916
897
  "no-multi-str": "error",
917
898
  "no-with": "error",
918
899
  "no-void": "error",
919
900
  "no-useless-escape": "off",
920
901
  "vars-on-top": "error",
921
902
  "require-await": "off",
922
- "no-return-assign": "off",
923
- "operator-linebreak": ["error", "before"]
903
+ "no-return-assign": "off"
924
904
  }
925
905
  }
926
906
  ];
@@ -1191,7 +1171,6 @@ const markdown = () => {
1191
1171
  "@typescript-eslint/no-unused-vars": "off",
1192
1172
  "@typescript-eslint/no-use-before-define": "off",
1193
1173
  "@typescript-eslint/no-var-requires": "off",
1194
- "@typescript-eslint/comma-dangle": "off",
1195
1174
  "@typescript-eslint/consistent-type-imports": "off",
1196
1175
  "@typescript-eslint/no-namespace": "off",
1197
1176
  "@typescript-eslint/no-require-imports": "off",
@@ -1205,7 +1184,11 @@ const markdown = () => {
1205
1184
  "no-unused-expressions": "off",
1206
1185
  "no-unused-vars": "off",
1207
1186
  // Off imports
1208
- "import/no-extraneous-dependencies": "off"
1187
+ "import/no-extraneous-dependencies": "off",
1188
+ "import/no-default-export": "off",
1189
+ "import/no-anonymous-default-export": "off",
1190
+ "react-refresh/only-export-components": "off",
1191
+ "react/jsx-no-undef": "off"
1209
1192
  }
1210
1193
  }
1211
1194
  ];
@@ -4008,115 +3991,144 @@ const react = () => {
4008
3991
  plugins: {
4009
3992
  react: pluginReact,
4010
3993
  "react-hooks": pluginReactHooks,
4011
- "ssr-friendly": pluginSSRFriendly,
4012
3994
  "react-refresh": pluginReactRefresh
4013
3995
  },
4014
3996
  rules: {
4015
3997
  ...pluginReact.configs.recommended.rules,
4016
3998
  ...pluginReact.configs["jsx-runtime"].rules,
4017
3999
  ...pluginReactHooks.configs.recommended.rules,
4018
- ...pluginSSRFriendly.configs.recommended.rules,
4019
- "jsx-quotes": ["error", "prefer-double"],
4020
4000
  "react/prop-types": "off",
4021
4001
  "react/no-unescaped-entities": "off",
4022
4002
  "react/no-unknown-property": "off",
4023
4003
  "react/jsx-boolean-value": ["error", "always"],
4024
- // Enforce new line when declare jsx element e.g. const element = (\newline<div
4025
- "react/jsx-wrap-multilines": [
4026
- "warn",
4027
- {
4028
- declaration: "parens-new-line",
4029
- assignment: "parens-new-line",
4030
- return: "parens-new-line",
4031
- arrow: "parens-new-line",
4032
- condition: "parens-new-line",
4033
- logical: "parens-new-line",
4034
- prop: "parens-new-line"
4035
- }
4036
- ],
4037
- "react/jsx-closing-tag-location": "error",
4038
- // Enforce disallow </ div>
4039
- "react/jsx-tag-spacing": ["error", { closingSlash: "never", beforeSelfClosing: "always", afterOpening: "never", beforeClosing: "allow" }],
4040
- "react/jsx-max-props-per-line": ["warn", { maximum: 1, when: "multiline" }],
4041
- // indentLogicalExpressions will fix && element
4042
- "react/jsx-indent": ["warn", 2, { indentLogicalExpressions: true }],
4043
- "react/jsx-indent-props": ["warn", 2],
4044
- // < and > should be on the same line(y-axis) if jsx is multiline
4045
- "react/jsx-closing-bracket-location": ["warn", "tag-aligned"],
4046
- // Enforce new line when multiline props jsx
4047
- "react/jsx-first-prop-new-line": ["warn", "multiline-multiprop"],
4048
4004
  // https://github.com/ArnaudBarre/eslint-plugin-react-refresh
4049
4005
  "react-refresh/only-export-components": "warn"
4050
4006
  }
4051
4007
  },
4052
4008
  {
4053
- files: ["**/*.test.{js,jsx,ts,tsx,cjs,mjs}", "**/*.spec.{js,jsx,ts,tsx,mjs,cjs}"],
4009
+ files: [
4010
+ `**/*config*.${GLOB_SCRIPT_EXT}`,
4011
+ `**/*{-entry,.entry}*.${GLOB_SCRIPT_EXT}`,
4012
+ GLOB_TEST_SCRIPT,
4013
+ GLOB_TEST_DIRS
4014
+ ],
4054
4015
  rules: {
4055
- ...mapValues(pluginSSRFriendly.configs.recommended.rules, () => "off"),
4056
- "ssr-friendly/only-export-components": "off"
4016
+ "react-refresh/only-export-components": "off"
4057
4017
  }
4058
4018
  }
4059
4019
  ];
4060
4020
  return config;
4061
4021
  };
4062
-
4063
- const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('index.cjs', document.baseURI).href)));
4064
- const tailwindcss = () => {
4065
- const pluginTailwindcss = require$1("eslint-plugin-tailwindcss");
4022
+ const ssrReact = () => {
4066
4023
  const config = [
4067
4024
  {
4068
- plugins: {
4069
- tailwindcss: pluginTailwindcss
4070
- },
4025
+ files: [GLOB_JSX, GLOB_TSX],
4071
4026
  languageOptions: {
4072
4027
  parserOptions: {
4073
- ecmaFeatures: {
4074
- jsx: true
4075
- }
4028
+ ...pluginReact.configs.recommended.parserOptions,
4029
+ ...pluginReact.configs["jsx-runtime"].parserOptions
4076
4030
  }
4077
4031
  },
4032
+ settings: {
4033
+ react: {
4034
+ // 'detect' will throw warn on monorepo
4035
+ version: "18.0"
4036
+ }
4037
+ },
4038
+ plugins: {
4039
+ "ssr-friendly": pluginSSRFriendly
4040
+ },
4078
4041
  rules: {
4079
- ...pluginTailwindcss.configs.recommended.rules,
4080
- "tailwindcss/no-custom-classname": "off"
4042
+ ...pluginSSRFriendly.configs.recommended.rules
4043
+ }
4044
+ },
4045
+ {
4046
+ files: [
4047
+ `**/*config*.${GLOB_SCRIPT_EXT}`,
4048
+ GLOB_TEST_SCRIPT,
4049
+ GLOB_TEST_DIRS
4050
+ ],
4051
+ rules: {
4052
+ ...mapValues(pluginSSRFriendly.configs.recommended.rules, () => "off")
4081
4053
  }
4082
4054
  }
4083
4055
  ];
4084
4056
  return config;
4085
4057
  };
4086
4058
 
4087
- const typescript = () => {
4059
+ const regexp = () => {
4088
4060
  const config = [
4089
4061
  {
4090
- files: [GLOB_TSX, GLOB_TS, GLOB_TEST_SCRIPT],
4091
4062
  languageOptions: {
4092
- parser: tsParser,
4063
+ globals: {
4064
+ ...globals$1.browser,
4065
+ ...globals$1.es2021,
4066
+ ...globals$1.node
4067
+ },
4093
4068
  parserOptions: {
4069
+ ecmaFeatures: {
4070
+ jsx: true
4071
+ },
4072
+ // Eslint doesn't supply ecmaVersion in `parser.js` `context.parserOptions`
4073
+ // This is required to avoid ecmaVersion < 2015 error or 'import' / 'export' error
4074
+ ecmaVersion: "latest",
4094
4075
  sourceType: "module"
4095
- }
4076
+ },
4077
+ sourceType: "module"
4096
4078
  },
4097
4079
  settings: {
4080
+ // This will do the trick
4081
+ "import/parsers": {
4082
+ espree: [".js", ".cjs", ".mjs", ".jsx"]
4083
+ },
4098
4084
  "import/resolver": {
4099
- node: { extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"] }
4085
+ node: true
4100
4086
  }
4101
4087
  },
4102
4088
  plugins: {
4103
- "@typescript-eslint": pluginTypeScript,
4104
- etc: pluginETC
4089
+ regexp: pluginRegexp
4105
4090
  },
4106
4091
  rules: {
4107
- ...pluginTypeScript.configs.recommended.rules,
4108
- // https://github.com/typescript-eslint/typescript-eslint/blob/main/docs/linting/troubleshooting/Performance.md#eslint-plugin-import
4109
- "import/named": "off",
4110
- "import/namespace": "off",
4111
- "import/default": "off",
4112
- "import/no-named-as-default-member": "off",
4113
- "import/no-named-as-default": "off",
4114
- // TS
4115
- "no-useless-constructor": "off",
4116
- indent: "off",
4117
- // https://github.com/prettier/prettier-eslint/issues/226
4118
- // JSX indent config in react
4119
- "@typescript-eslint/indent": ["error", 2, {
4092
+ ...pluginRegexp.configs.recommended.rules
4093
+ }
4094
+ }
4095
+ ];
4096
+ return config;
4097
+ };
4098
+
4099
+ const stylistic = () => {
4100
+ const config = pluginStylistic.configs.customize({
4101
+ flat: true,
4102
+ indent: 2,
4103
+ jsx: true,
4104
+ quotes: "single",
4105
+ semi: false
4106
+ });
4107
+ const off = {};
4108
+ Object.keys(config.rules).forEach((key) => {
4109
+ off[key.replace("@stylistic/", "")] = "off";
4110
+ });
4111
+ const configs = [
4112
+ {
4113
+ files: [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX],
4114
+ plugins: {
4115
+ ...config.plugins
4116
+ },
4117
+ rules: {
4118
+ ...off,
4119
+ ...config.rules,
4120
+ "@stylistic/quotes": ["error", "single"],
4121
+ "@stylistic/quote-props": ["error", "as-needed"],
4122
+ "@stylistic/array-bracket-spacing": ["error", "never"],
4123
+ // https://eslint.org/docs/latest/rules/brace-style#1tbs
4124
+ "@stylistic/brace-style": ["error", "1tbs"],
4125
+ "@stylistic/block-spacing": ["error", "always"],
4126
+ "@stylistic/comma-spacing": ["error", { before: false, after: true }],
4127
+ "@stylistic/comma-style": ["error", "last"],
4128
+ "comma-dangle": "off",
4129
+ "@stylistic/comma-dangle": ["error", "always-multiline"],
4130
+ "@stylistic/key-spacing": ["error", { beforeColon: false, afterColon: true }],
4131
+ "@stylistic/indent": ["error", 2, {
4120
4132
  SwitchCase: 1,
4121
4133
  VariableDeclarator: 1,
4122
4134
  outerIIFEBody: 1,
@@ -4154,8 +4166,119 @@ const typescript = () => {
4154
4166
  ],
4155
4167
  offsetTernaryExpressions: true
4156
4168
  }],
4157
- "@typescript-eslint/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
4158
- "@typescript-eslint/type-annotation-spacing": ["error", {}],
4169
+ "@stylistic/object-curly-spacing": ["error", "always"],
4170
+ "@stylistic/template-curly-spacing": "error",
4171
+ "@stylistic/generator-star-spacing": "off",
4172
+ "@stylistic/no-multi-spaces": "error",
4173
+ "@stylistic/operator-linebreak": ["error", "before"],
4174
+ "@stylistic/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
4175
+ "@stylistic/type-annotation-spacing": ["error", {}],
4176
+ // no-spaced-func alert -- https://eslint.org/docs/latest/rules/no-spaced-func
4177
+ "@stylistic/func-call-spacing": ["error", "never"],
4178
+ "@stylistic/semi": ["error", "never"],
4179
+ "@stylistic/space-before-blocks": ["error", "always"],
4180
+ "@stylistic/space-before-function-paren": [
4181
+ "error",
4182
+ {
4183
+ anonymous: "always",
4184
+ named: "never",
4185
+ asyncArrow: "always"
4186
+ }
4187
+ ],
4188
+ "@stylistic/space-infix-ops": "error",
4189
+ "@stylistic/keyword-spacing": ["error", { before: true, after: true }],
4190
+ "@stylistic/no-extra-parens": ["error", "functions"],
4191
+ "@stylistic/lines-between-class-members": [
4192
+ "error",
4193
+ "always",
4194
+ { exceptAfterSingleLine: true }
4195
+ ],
4196
+ "@stylistic/jsx-quotes": ["error", "prefer-double"],
4197
+ // React
4198
+ // Enforce new line when declare jsx element e.g. const element = (\newline<div
4199
+ "@stylistic/jsx-wrap-multilines": [
4200
+ "warn",
4201
+ {
4202
+ declaration: "parens-new-line",
4203
+ assignment: "parens-new-line",
4204
+ return: "parens-new-line",
4205
+ arrow: "parens-new-line",
4206
+ condition: "parens-new-line",
4207
+ logical: "parens-new-line",
4208
+ prop: "parens-new-line"
4209
+ }
4210
+ ],
4211
+ "@stylistic/jsx-closing-tag-location": "error",
4212
+ // Enforce disallow </ div>
4213
+ "@stylistic/jsx-tag-spacing": ["error", { closingSlash: "never", beforeSelfClosing: "always", afterOpening: "never", beforeClosing: "allow" }],
4214
+ "@stylistic/jsx-max-props-per-line": ["warn", { maximum: 1, when: "multiline" }],
4215
+ // indentLogicalExpressions will fix && element
4216
+ "@stylistic/jsx-indent": ["warn", 2, { indentLogicalExpressions: true }],
4217
+ "@stylistic/jsx-indent-props": ["warn", 2],
4218
+ // < and > should be on the same line(y-axis) if jsx is multiline
4219
+ "@stylistic/jsx-closing-bracket-location": ["warn", "tag-aligned"],
4220
+ // Enforce new line when multiline props jsx
4221
+ "@stylistic/jsx-first-prop-new-line": ["warn", "multiline-multiprop"],
4222
+ "@stylistic/jsx-one-expression-per-line": "off"
4223
+ }
4224
+ }
4225
+ ];
4226
+ return configs;
4227
+ };
4228
+
4229
+ const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('index.cjs', document.baseURI).href)));
4230
+ const tailwindcss = () => {
4231
+ const pluginTailwindcss = require$1("eslint-plugin-tailwindcss");
4232
+ const config = [
4233
+ {
4234
+ plugins: {
4235
+ tailwindcss: pluginTailwindcss
4236
+ },
4237
+ languageOptions: {
4238
+ parserOptions: {
4239
+ ecmaFeatures: {
4240
+ jsx: true
4241
+ }
4242
+ }
4243
+ },
4244
+ rules: {
4245
+ ...pluginTailwindcss.configs.recommended.rules,
4246
+ "tailwindcss/no-custom-classname": "off"
4247
+ }
4248
+ }
4249
+ ];
4250
+ return config;
4251
+ };
4252
+
4253
+ const typescript = () => {
4254
+ const config = [
4255
+ {
4256
+ files: [GLOB_TSX, GLOB_TS, GLOB_TEST_SCRIPT],
4257
+ languageOptions: {
4258
+ parser: tsParser,
4259
+ parserOptions: {
4260
+ sourceType: "module"
4261
+ }
4262
+ },
4263
+ settings: {
4264
+ "import/resolver": {
4265
+ node: { extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"] }
4266
+ }
4267
+ },
4268
+ plugins: {
4269
+ "@typescript-eslint": pluginTypeScript,
4270
+ etc: pluginETC
4271
+ },
4272
+ rules: {
4273
+ ...pluginTypeScript.configs.recommended.rules,
4274
+ // https://github.com/typescript-eslint/typescript-eslint/blob/main/docs/linting/troubleshooting/Performance.md#eslint-plugin-import
4275
+ "import/named": "off",
4276
+ "import/namespace": "off",
4277
+ "import/default": "off",
4278
+ "import/no-named-as-default-member": "off",
4279
+ "import/no-named-as-default": "off",
4280
+ // TS
4281
+ "no-useless-constructor": "off",
4159
4282
  "@typescript-eslint/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
4160
4283
  "@typescript-eslint/consistent-type-imports": [
4161
4284
  "error",
@@ -4189,9 +4312,6 @@ const typescript = () => {
4189
4312
  // original no-undef not compatiable with typescript
4190
4313
  // 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
4191
4314
  "no-undef": "off",
4192
- // no-spaced-func alert -- https://eslint.org/docs/latest/rules/no-spaced-func
4193
- "func-call-spacing": "off",
4194
- "@typescript-eslint/func-call-spacing": ["error", "never"],
4195
4315
  "no-unused-vars": "off",
4196
4316
  "no-redeclare": "off",
4197
4317
  "@typescript-eslint/no-redeclare": "error",
@@ -4202,44 +4322,8 @@ const typescript = () => {
4202
4322
  "error",
4203
4323
  { functions: false, classes: false, variables: true }
4204
4324
  ],
4205
- "brace-style": "off",
4206
- // https://eslint.org/docs/latest/rules/brace-style#1tbs
4207
- "@typescript-eslint/brace-style": ["error", "1tbs"],
4208
- "comma-dangle": "off",
4209
- "@typescript-eslint/comma-dangle": ["error", "always-multiline"],
4210
- "object-curly-spacing": "off",
4211
- "@typescript-eslint/object-curly-spacing": ["error", "always"],
4212
- semi: "off",
4213
- "@typescript-eslint/semi": ["error", "never"],
4214
- quotes: "off",
4215
- "@typescript-eslint/quotes": ["error", "single"],
4216
- "space-before-blocks": "off",
4217
- "@typescript-eslint/space-before-blocks": ["error", "always"],
4218
- "space-before-function-paren": "off",
4219
- "@typescript-eslint/space-before-function-paren": [
4220
- "error",
4221
- {
4222
- anonymous: "always",
4223
- named: "never",
4224
- asyncArrow: "always"
4225
- }
4226
- ],
4227
- "space-infix-ops": "off",
4228
- "@typescript-eslint/space-infix-ops": "error",
4229
- "keyword-spacing": "off",
4230
- "@typescript-eslint/keyword-spacing": ["error", { before: true, after: true }],
4231
- "comma-spacing": "off",
4232
- "@typescript-eslint/comma-spacing": ["error", { before: false, after: true }],
4233
- "no-extra-parens": "off",
4234
- "@typescript-eslint/no-extra-parens": ["error", "functions"],
4235
4325
  "no-loss-of-precision": "off",
4236
4326
  "@typescript-eslint/no-loss-of-precision": "error",
4237
- "lines-between-class-members": "off",
4238
- "@typescript-eslint/lines-between-class-members": [
4239
- "error",
4240
- "always",
4241
- { exceptAfterSingleLine: true }
4242
- ],
4243
4327
  // off
4244
4328
  "@typescript-eslint/camelcase": "off",
4245
4329
  "@typescript-eslint/explicit-function-return-type": "off",
@@ -4363,10 +4447,11 @@ const presetLangsExtensions = [
4363
4447
  const presetDefault = [
4364
4448
  ...presetTypescript,
4365
4449
  ...react(),
4450
+ ...stylistic(),
4366
4451
  ...presetLangsExtensions,
4367
4452
  ...progress()
4368
4453
  ];
4369
- const aiou = (config = []) => {
4454
+ const aiou = ({ ssr = true, regexp: regexp$1 = true } = { ssr: true, regexp: true }, config = []) => {
4370
4455
  const configs = [...presetDefault];
4371
4456
  if (localPkg.isPackageExists("tailwindcss")) {
4372
4457
  configs.push(...tailwindcss());
@@ -4374,6 +4459,12 @@ const aiou = (config = []) => {
4374
4459
  if (localPkg.isPackageExists("next")) {
4375
4460
  configs.push(...next());
4376
4461
  }
4462
+ if (ssr) {
4463
+ configs.push(...ssrReact());
4464
+ }
4465
+ if (regexp$1) {
4466
+ configs.push(...regexp());
4467
+ }
4377
4468
  if (Object.keys(config).length > 0) {
4378
4469
  configs.push(...Array.isArray(config) ? config : [config]);
4379
4470
  }
package/dist/index.mjs CHANGED
@@ -7,7 +7,6 @@ import pluginSimpleImportSort from 'eslint-plugin-simple-import-sort';
7
7
  import pluginUnsedImports from 'eslint-plugin-unused-imports';
8
8
  import pluginN from 'eslint-plugin-n';
9
9
  import pluginPromise from 'eslint-plugin-promise';
10
- import pluginRegexp from 'eslint-plugin-regexp';
11
10
  import globals$1 from 'globals';
12
11
  import pluginJsonc from 'eslint-plugin-jsonc';
13
12
  import jsoncParser from 'jsonc-eslint-parser';
@@ -18,6 +17,8 @@ import pluginReact from 'eslint-plugin-react';
18
17
  import pluginReactHooks from 'eslint-plugin-react-hooks';
19
18
  import pluginReactRefresh from 'eslint-plugin-react-refresh';
20
19
  import pluginSSRFriendly from 'eslint-plugin-ssr-friendly';
20
+ import pluginRegexp from 'eslint-plugin-regexp';
21
+ import pluginStylistic from '@stylistic/eslint-plugin';
21
22
  import { createRequire } from 'node:module';
22
23
  import pluginTypeScript from '@typescript-eslint/eslint-plugin';
23
24
  import tsParser from '@typescript-eslint/parser';
@@ -56,6 +57,7 @@ const GLOB_TEST_DIRS = "**/{test,tests,e2e,__test__,__tests__}/**";
56
57
  const GLOB_DTS = "**/*.d.ts";
57
58
  const GLOB_TS = "**/*.?([cm])ts";
58
59
  const GLOB_TSX = "**/*.?([cm])tsx";
60
+ const GLOB_JS = "**/*.?([cm])js";
59
61
  const GLOB_JSX = "**/*.?([cm])jsx";
60
62
  const GLOB_JSON = "**/*.json";
61
63
  const GLOB_JSON5 = "**/*.json5";
@@ -121,7 +123,7 @@ const imports = () => {
121
123
  "import-newlines/enforce": [
122
124
  "error",
123
125
  {
124
- items: 4,
126
+ items: 2,
125
127
  "max-len": 120,
126
128
  semi: false
127
129
  }
@@ -151,7 +153,9 @@ const imports = () => {
151
153
  `**/App*.${GLOB_SCRIPT_EXT}`,
152
154
  `**/Document.${GLOB_SCRIPT_EXT}`,
153
155
  "**/{vite,esbuild,rollup,webpack,rspack}.ts",
154
- GLOB_DTS
156
+ GLOB_DTS,
157
+ GLOB_TEST_SCRIPT,
158
+ GLOB_TEST_DIRS
155
159
  ],
156
160
  rules: {
157
161
  // related: https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/docs/TROUBLESHOOTING.md#edits-always-lead-to-full-reload
@@ -832,45 +836,25 @@ const javascript = () => {
832
836
  },
833
837
  plugins: {
834
838
  n: pluginN,
835
- promise: pluginPromise,
836
- regexp: pluginRegexp
839
+ promise: pluginPromise
837
840
  },
838
841
  rules: {
839
842
  ...pluginStandard.rules,
840
- ...pluginRegexp.configs.recommended.rules,
841
- // Common
842
- semi: ["error", "never"],
843
- // Always need {}
844
843
  curly: ["error", "all"],
845
- quotes: ["error", "single"],
846
- "quote-props": ["error", "as-needed"],
847
844
  "no-unused-vars": "warn",
848
845
  "no-param-reassign": "off",
849
- "array-bracket-spacing": ["error", "never"],
850
- // https://eslint.org/docs/latest/rules/brace-style#1tbs
851
- "brace-style": ["error", "1tbs"],
852
- "block-spacing": ["error", "always"],
853
846
  camelcase: "off",
854
- "comma-spacing": ["error", { before: false, after: true }],
855
- "comma-style": ["error", "last"],
856
- "comma-dangle": ["error", "always-multiline"],
857
847
  "no-constant-condition": "warn",
858
848
  "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off",
859
849
  "no-console": process.env.NODE_ENV === "production" ? "error" : "off",
860
850
  "no-cond-assign": ["error", "always"],
861
- "func-call-spacing": ["off", "never"],
862
- "key-spacing": ["error", { beforeColon: false, afterColon: true }],
863
- // https://github.com/prettier/prettier-eslint/issues/226
864
- indent: ["error", 2, { SwitchCase: 1, VariableDeclarator: 1, outerIIFEBody: 1 }],
865
851
  "no-restricted-syntax": [
866
852
  "error",
867
853
  "DebuggerStatement",
868
854
  "LabeledStatement",
869
855
  "WithStatement"
870
856
  ],
871
- "object-curly-spacing": ["error", "always"],
872
857
  "no-return-await": "off",
873
- "space-before-function-paren": ["error", "never"],
874
858
  // es6
875
859
  "no-var": "error",
876
860
  "prefer-const": [
@@ -899,9 +883,7 @@ const javascript = () => {
899
883
  "prefer-rest-params": "error",
900
884
  "prefer-spread": "error",
901
885
  "prefer-template": "error",
902
- "template-curly-spacing": "error",
903
886
  "arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
904
- "generator-star-spacing": "off",
905
887
  // best-practice
906
888
  "array-callback-return": "error",
907
889
  "block-scoped-var": "error",
@@ -910,15 +892,13 @@ const javascript = () => {
910
892
  eqeqeq: ["error", "allow-null"],
911
893
  "no-alert": "warn",
912
894
  "no-case-declarations": "error",
913
- "no-multi-spaces": "error",
914
895
  "no-multi-str": "error",
915
896
  "no-with": "error",
916
897
  "no-void": "error",
917
898
  "no-useless-escape": "off",
918
899
  "vars-on-top": "error",
919
900
  "require-await": "off",
920
- "no-return-assign": "off",
921
- "operator-linebreak": ["error", "before"]
901
+ "no-return-assign": "off"
922
902
  }
923
903
  }
924
904
  ];
@@ -1189,7 +1169,6 @@ const markdown = () => {
1189
1169
  "@typescript-eslint/no-unused-vars": "off",
1190
1170
  "@typescript-eslint/no-use-before-define": "off",
1191
1171
  "@typescript-eslint/no-var-requires": "off",
1192
- "@typescript-eslint/comma-dangle": "off",
1193
1172
  "@typescript-eslint/consistent-type-imports": "off",
1194
1173
  "@typescript-eslint/no-namespace": "off",
1195
1174
  "@typescript-eslint/no-require-imports": "off",
@@ -1203,7 +1182,11 @@ const markdown = () => {
1203
1182
  "no-unused-expressions": "off",
1204
1183
  "no-unused-vars": "off",
1205
1184
  // Off imports
1206
- "import/no-extraneous-dependencies": "off"
1185
+ "import/no-extraneous-dependencies": "off",
1186
+ "import/no-default-export": "off",
1187
+ "import/no-anonymous-default-export": "off",
1188
+ "react-refresh/only-export-components": "off",
1189
+ "react/jsx-no-undef": "off"
1207
1190
  }
1208
1191
  }
1209
1192
  ];
@@ -4006,115 +3989,144 @@ const react = () => {
4006
3989
  plugins: {
4007
3990
  react: pluginReact,
4008
3991
  "react-hooks": pluginReactHooks,
4009
- "ssr-friendly": pluginSSRFriendly,
4010
3992
  "react-refresh": pluginReactRefresh
4011
3993
  },
4012
3994
  rules: {
4013
3995
  ...pluginReact.configs.recommended.rules,
4014
3996
  ...pluginReact.configs["jsx-runtime"].rules,
4015
3997
  ...pluginReactHooks.configs.recommended.rules,
4016
- ...pluginSSRFriendly.configs.recommended.rules,
4017
- "jsx-quotes": ["error", "prefer-double"],
4018
3998
  "react/prop-types": "off",
4019
3999
  "react/no-unescaped-entities": "off",
4020
4000
  "react/no-unknown-property": "off",
4021
4001
  "react/jsx-boolean-value": ["error", "always"],
4022
- // Enforce new line when declare jsx element e.g. const element = (\newline<div
4023
- "react/jsx-wrap-multilines": [
4024
- "warn",
4025
- {
4026
- declaration: "parens-new-line",
4027
- assignment: "parens-new-line",
4028
- return: "parens-new-line",
4029
- arrow: "parens-new-line",
4030
- condition: "parens-new-line",
4031
- logical: "parens-new-line",
4032
- prop: "parens-new-line"
4033
- }
4034
- ],
4035
- "react/jsx-closing-tag-location": "error",
4036
- // Enforce disallow </ div>
4037
- "react/jsx-tag-spacing": ["error", { closingSlash: "never", beforeSelfClosing: "always", afterOpening: "never", beforeClosing: "allow" }],
4038
- "react/jsx-max-props-per-line": ["warn", { maximum: 1, when: "multiline" }],
4039
- // indentLogicalExpressions will fix && element
4040
- "react/jsx-indent": ["warn", 2, { indentLogicalExpressions: true }],
4041
- "react/jsx-indent-props": ["warn", 2],
4042
- // < and > should be on the same line(y-axis) if jsx is multiline
4043
- "react/jsx-closing-bracket-location": ["warn", "tag-aligned"],
4044
- // Enforce new line when multiline props jsx
4045
- "react/jsx-first-prop-new-line": ["warn", "multiline-multiprop"],
4046
4002
  // https://github.com/ArnaudBarre/eslint-plugin-react-refresh
4047
4003
  "react-refresh/only-export-components": "warn"
4048
4004
  }
4049
4005
  },
4050
4006
  {
4051
- files: ["**/*.test.{js,jsx,ts,tsx,cjs,mjs}", "**/*.spec.{js,jsx,ts,tsx,mjs,cjs}"],
4007
+ files: [
4008
+ `**/*config*.${GLOB_SCRIPT_EXT}`,
4009
+ `**/*{-entry,.entry}*.${GLOB_SCRIPT_EXT}`,
4010
+ GLOB_TEST_SCRIPT,
4011
+ GLOB_TEST_DIRS
4012
+ ],
4052
4013
  rules: {
4053
- ...mapValues(pluginSSRFriendly.configs.recommended.rules, () => "off"),
4054
- "ssr-friendly/only-export-components": "off"
4014
+ "react-refresh/only-export-components": "off"
4055
4015
  }
4056
4016
  }
4057
4017
  ];
4058
4018
  return config;
4059
4019
  };
4060
-
4061
- const require = createRequire(import.meta.url);
4062
- const tailwindcss = () => {
4063
- const pluginTailwindcss = require("eslint-plugin-tailwindcss");
4020
+ const ssrReact = () => {
4064
4021
  const config = [
4065
4022
  {
4066
- plugins: {
4067
- tailwindcss: pluginTailwindcss
4068
- },
4023
+ files: [GLOB_JSX, GLOB_TSX],
4069
4024
  languageOptions: {
4070
4025
  parserOptions: {
4071
- ecmaFeatures: {
4072
- jsx: true
4073
- }
4026
+ ...pluginReact.configs.recommended.parserOptions,
4027
+ ...pluginReact.configs["jsx-runtime"].parserOptions
4074
4028
  }
4075
4029
  },
4030
+ settings: {
4031
+ react: {
4032
+ // 'detect' will throw warn on monorepo
4033
+ version: "18.0"
4034
+ }
4035
+ },
4036
+ plugins: {
4037
+ "ssr-friendly": pluginSSRFriendly
4038
+ },
4076
4039
  rules: {
4077
- ...pluginTailwindcss.configs.recommended.rules,
4078
- "tailwindcss/no-custom-classname": "off"
4040
+ ...pluginSSRFriendly.configs.recommended.rules
4041
+ }
4042
+ },
4043
+ {
4044
+ files: [
4045
+ `**/*config*.${GLOB_SCRIPT_EXT}`,
4046
+ GLOB_TEST_SCRIPT,
4047
+ GLOB_TEST_DIRS
4048
+ ],
4049
+ rules: {
4050
+ ...mapValues(pluginSSRFriendly.configs.recommended.rules, () => "off")
4079
4051
  }
4080
4052
  }
4081
4053
  ];
4082
4054
  return config;
4083
4055
  };
4084
4056
 
4085
- const typescript = () => {
4057
+ const regexp = () => {
4086
4058
  const config = [
4087
4059
  {
4088
- files: [GLOB_TSX, GLOB_TS, GLOB_TEST_SCRIPT],
4089
4060
  languageOptions: {
4090
- parser: tsParser,
4061
+ globals: {
4062
+ ...globals$1.browser,
4063
+ ...globals$1.es2021,
4064
+ ...globals$1.node
4065
+ },
4091
4066
  parserOptions: {
4067
+ ecmaFeatures: {
4068
+ jsx: true
4069
+ },
4070
+ // Eslint doesn't supply ecmaVersion in `parser.js` `context.parserOptions`
4071
+ // This is required to avoid ecmaVersion < 2015 error or 'import' / 'export' error
4072
+ ecmaVersion: "latest",
4092
4073
  sourceType: "module"
4093
- }
4074
+ },
4075
+ sourceType: "module"
4094
4076
  },
4095
4077
  settings: {
4078
+ // This will do the trick
4079
+ "import/parsers": {
4080
+ espree: [".js", ".cjs", ".mjs", ".jsx"]
4081
+ },
4096
4082
  "import/resolver": {
4097
- node: { extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"] }
4083
+ node: true
4098
4084
  }
4099
4085
  },
4100
4086
  plugins: {
4101
- "@typescript-eslint": pluginTypeScript,
4102
- etc: pluginETC
4087
+ regexp: pluginRegexp
4103
4088
  },
4104
4089
  rules: {
4105
- ...pluginTypeScript.configs.recommended.rules,
4106
- // https://github.com/typescript-eslint/typescript-eslint/blob/main/docs/linting/troubleshooting/Performance.md#eslint-plugin-import
4107
- "import/named": "off",
4108
- "import/namespace": "off",
4109
- "import/default": "off",
4110
- "import/no-named-as-default-member": "off",
4111
- "import/no-named-as-default": "off",
4112
- // TS
4113
- "no-useless-constructor": "off",
4114
- indent: "off",
4115
- // https://github.com/prettier/prettier-eslint/issues/226
4116
- // JSX indent config in react
4117
- "@typescript-eslint/indent": ["error", 2, {
4090
+ ...pluginRegexp.configs.recommended.rules
4091
+ }
4092
+ }
4093
+ ];
4094
+ return config;
4095
+ };
4096
+
4097
+ const stylistic = () => {
4098
+ const config = pluginStylistic.configs.customize({
4099
+ flat: true,
4100
+ indent: 2,
4101
+ jsx: true,
4102
+ quotes: "single",
4103
+ semi: false
4104
+ });
4105
+ const off = {};
4106
+ Object.keys(config.rules).forEach((key) => {
4107
+ off[key.replace("@stylistic/", "")] = "off";
4108
+ });
4109
+ const configs = [
4110
+ {
4111
+ files: [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX],
4112
+ plugins: {
4113
+ ...config.plugins
4114
+ },
4115
+ rules: {
4116
+ ...off,
4117
+ ...config.rules,
4118
+ "@stylistic/quotes": ["error", "single"],
4119
+ "@stylistic/quote-props": ["error", "as-needed"],
4120
+ "@stylistic/array-bracket-spacing": ["error", "never"],
4121
+ // https://eslint.org/docs/latest/rules/brace-style#1tbs
4122
+ "@stylistic/brace-style": ["error", "1tbs"],
4123
+ "@stylistic/block-spacing": ["error", "always"],
4124
+ "@stylistic/comma-spacing": ["error", { before: false, after: true }],
4125
+ "@stylistic/comma-style": ["error", "last"],
4126
+ "comma-dangle": "off",
4127
+ "@stylistic/comma-dangle": ["error", "always-multiline"],
4128
+ "@stylistic/key-spacing": ["error", { beforeColon: false, afterColon: true }],
4129
+ "@stylistic/indent": ["error", 2, {
4118
4130
  SwitchCase: 1,
4119
4131
  VariableDeclarator: 1,
4120
4132
  outerIIFEBody: 1,
@@ -4152,8 +4164,119 @@ const typescript = () => {
4152
4164
  ],
4153
4165
  offsetTernaryExpressions: true
4154
4166
  }],
4155
- "@typescript-eslint/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
4156
- "@typescript-eslint/type-annotation-spacing": ["error", {}],
4167
+ "@stylistic/object-curly-spacing": ["error", "always"],
4168
+ "@stylistic/template-curly-spacing": "error",
4169
+ "@stylistic/generator-star-spacing": "off",
4170
+ "@stylistic/no-multi-spaces": "error",
4171
+ "@stylistic/operator-linebreak": ["error", "before"],
4172
+ "@stylistic/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
4173
+ "@stylistic/type-annotation-spacing": ["error", {}],
4174
+ // no-spaced-func alert -- https://eslint.org/docs/latest/rules/no-spaced-func
4175
+ "@stylistic/func-call-spacing": ["error", "never"],
4176
+ "@stylistic/semi": ["error", "never"],
4177
+ "@stylistic/space-before-blocks": ["error", "always"],
4178
+ "@stylistic/space-before-function-paren": [
4179
+ "error",
4180
+ {
4181
+ anonymous: "always",
4182
+ named: "never",
4183
+ asyncArrow: "always"
4184
+ }
4185
+ ],
4186
+ "@stylistic/space-infix-ops": "error",
4187
+ "@stylistic/keyword-spacing": ["error", { before: true, after: true }],
4188
+ "@stylistic/no-extra-parens": ["error", "functions"],
4189
+ "@stylistic/lines-between-class-members": [
4190
+ "error",
4191
+ "always",
4192
+ { exceptAfterSingleLine: true }
4193
+ ],
4194
+ "@stylistic/jsx-quotes": ["error", "prefer-double"],
4195
+ // React
4196
+ // Enforce new line when declare jsx element e.g. const element = (\newline<div
4197
+ "@stylistic/jsx-wrap-multilines": [
4198
+ "warn",
4199
+ {
4200
+ declaration: "parens-new-line",
4201
+ assignment: "parens-new-line",
4202
+ return: "parens-new-line",
4203
+ arrow: "parens-new-line",
4204
+ condition: "parens-new-line",
4205
+ logical: "parens-new-line",
4206
+ prop: "parens-new-line"
4207
+ }
4208
+ ],
4209
+ "@stylistic/jsx-closing-tag-location": "error",
4210
+ // Enforce disallow </ div>
4211
+ "@stylistic/jsx-tag-spacing": ["error", { closingSlash: "never", beforeSelfClosing: "always", afterOpening: "never", beforeClosing: "allow" }],
4212
+ "@stylistic/jsx-max-props-per-line": ["warn", { maximum: 1, when: "multiline" }],
4213
+ // indentLogicalExpressions will fix && element
4214
+ "@stylistic/jsx-indent": ["warn", 2, { indentLogicalExpressions: true }],
4215
+ "@stylistic/jsx-indent-props": ["warn", 2],
4216
+ // < and > should be on the same line(y-axis) if jsx is multiline
4217
+ "@stylistic/jsx-closing-bracket-location": ["warn", "tag-aligned"],
4218
+ // Enforce new line when multiline props jsx
4219
+ "@stylistic/jsx-first-prop-new-line": ["warn", "multiline-multiprop"],
4220
+ "@stylistic/jsx-one-expression-per-line": "off"
4221
+ }
4222
+ }
4223
+ ];
4224
+ return configs;
4225
+ };
4226
+
4227
+ const require = createRequire(import.meta.url);
4228
+ const tailwindcss = () => {
4229
+ const pluginTailwindcss = require("eslint-plugin-tailwindcss");
4230
+ const config = [
4231
+ {
4232
+ plugins: {
4233
+ tailwindcss: pluginTailwindcss
4234
+ },
4235
+ languageOptions: {
4236
+ parserOptions: {
4237
+ ecmaFeatures: {
4238
+ jsx: true
4239
+ }
4240
+ }
4241
+ },
4242
+ rules: {
4243
+ ...pluginTailwindcss.configs.recommended.rules,
4244
+ "tailwindcss/no-custom-classname": "off"
4245
+ }
4246
+ }
4247
+ ];
4248
+ return config;
4249
+ };
4250
+
4251
+ const typescript = () => {
4252
+ const config = [
4253
+ {
4254
+ files: [GLOB_TSX, GLOB_TS, GLOB_TEST_SCRIPT],
4255
+ languageOptions: {
4256
+ parser: tsParser,
4257
+ parserOptions: {
4258
+ sourceType: "module"
4259
+ }
4260
+ },
4261
+ settings: {
4262
+ "import/resolver": {
4263
+ node: { extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"] }
4264
+ }
4265
+ },
4266
+ plugins: {
4267
+ "@typescript-eslint": pluginTypeScript,
4268
+ etc: pluginETC
4269
+ },
4270
+ rules: {
4271
+ ...pluginTypeScript.configs.recommended.rules,
4272
+ // https://github.com/typescript-eslint/typescript-eslint/blob/main/docs/linting/troubleshooting/Performance.md#eslint-plugin-import
4273
+ "import/named": "off",
4274
+ "import/namespace": "off",
4275
+ "import/default": "off",
4276
+ "import/no-named-as-default-member": "off",
4277
+ "import/no-named-as-default": "off",
4278
+ // TS
4279
+ "no-useless-constructor": "off",
4157
4280
  "@typescript-eslint/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
4158
4281
  "@typescript-eslint/consistent-type-imports": [
4159
4282
  "error",
@@ -4187,9 +4310,6 @@ const typescript = () => {
4187
4310
  // original no-undef not compatiable with typescript
4188
4311
  // 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
4189
4312
  "no-undef": "off",
4190
- // no-spaced-func alert -- https://eslint.org/docs/latest/rules/no-spaced-func
4191
- "func-call-spacing": "off",
4192
- "@typescript-eslint/func-call-spacing": ["error", "never"],
4193
4313
  "no-unused-vars": "off",
4194
4314
  "no-redeclare": "off",
4195
4315
  "@typescript-eslint/no-redeclare": "error",
@@ -4200,44 +4320,8 @@ const typescript = () => {
4200
4320
  "error",
4201
4321
  { functions: false, classes: false, variables: true }
4202
4322
  ],
4203
- "brace-style": "off",
4204
- // https://eslint.org/docs/latest/rules/brace-style#1tbs
4205
- "@typescript-eslint/brace-style": ["error", "1tbs"],
4206
- "comma-dangle": "off",
4207
- "@typescript-eslint/comma-dangle": ["error", "always-multiline"],
4208
- "object-curly-spacing": "off",
4209
- "@typescript-eslint/object-curly-spacing": ["error", "always"],
4210
- semi: "off",
4211
- "@typescript-eslint/semi": ["error", "never"],
4212
- quotes: "off",
4213
- "@typescript-eslint/quotes": ["error", "single"],
4214
- "space-before-blocks": "off",
4215
- "@typescript-eslint/space-before-blocks": ["error", "always"],
4216
- "space-before-function-paren": "off",
4217
- "@typescript-eslint/space-before-function-paren": [
4218
- "error",
4219
- {
4220
- anonymous: "always",
4221
- named: "never",
4222
- asyncArrow: "always"
4223
- }
4224
- ],
4225
- "space-infix-ops": "off",
4226
- "@typescript-eslint/space-infix-ops": "error",
4227
- "keyword-spacing": "off",
4228
- "@typescript-eslint/keyword-spacing": ["error", { before: true, after: true }],
4229
- "comma-spacing": "off",
4230
- "@typescript-eslint/comma-spacing": ["error", { before: false, after: true }],
4231
- "no-extra-parens": "off",
4232
- "@typescript-eslint/no-extra-parens": ["error", "functions"],
4233
4323
  "no-loss-of-precision": "off",
4234
4324
  "@typescript-eslint/no-loss-of-precision": "error",
4235
- "lines-between-class-members": "off",
4236
- "@typescript-eslint/lines-between-class-members": [
4237
- "error",
4238
- "always",
4239
- { exceptAfterSingleLine: true }
4240
- ],
4241
4325
  // off
4242
4326
  "@typescript-eslint/camelcase": "off",
4243
4327
  "@typescript-eslint/explicit-function-return-type": "off",
@@ -4361,10 +4445,11 @@ const presetLangsExtensions = [
4361
4445
  const presetDefault = [
4362
4446
  ...presetTypescript,
4363
4447
  ...react(),
4448
+ ...stylistic(),
4364
4449
  ...presetLangsExtensions,
4365
4450
  ...progress()
4366
4451
  ];
4367
- const aiou = (config = []) => {
4452
+ const aiou = ({ ssr = true, regexp: regexp$1 = true } = { ssr: true, regexp: true }, config = []) => {
4368
4453
  const configs = [...presetDefault];
4369
4454
  if (isPackageExists("tailwindcss")) {
4370
4455
  configs.push(...tailwindcss());
@@ -4372,6 +4457,12 @@ const aiou = (config = []) => {
4372
4457
  if (isPackageExists("next")) {
4373
4458
  configs.push(...next());
4374
4459
  }
4460
+ if (ssr) {
4461
+ configs.push(...ssrReact());
4462
+ }
4463
+ if (regexp$1) {
4464
+ configs.push(...regexp());
4465
+ }
4375
4466
  if (Object.keys(config).length > 0) {
4376
4467
  configs.push(...Array.isArray(config) ? config : [config]);
4377
4468
  }
@@ -1,2 +1,2 @@
1
- import type { FlatESLintConfigItem } from 'eslint-define-config';
2
- export declare const comments: () => FlatESLintConfigItem[];
1
+ import type { FlatESLintConfig } from 'eslint-define-config';
2
+ export declare const comments: () => FlatESLintConfig[];
@@ -1,2 +1,2 @@
1
- import type { FlatESLintConfigItem } from 'eslint-define-config';
2
- export declare const ignores: () => FlatESLintConfigItem[];
1
+ import type { FlatESLintConfig } from 'eslint-define-config';
2
+ export declare const ignores: () => FlatESLintConfig[];
@@ -1,2 +1,2 @@
1
- import type { FlatESLintConfigItem } from 'eslint-define-config';
2
- export declare const imports: () => FlatESLintConfigItem[];
1
+ import type { FlatESLintConfig } from 'eslint-define-config';
2
+ export declare const imports: () => FlatESLintConfig[];
@@ -1,2 +1,2 @@
1
- import type { FlatESLintConfigItem } from 'eslint-define-config';
2
- export declare const javascript: () => FlatESLintConfigItem[];
1
+ import type { FlatESLintConfig } from 'eslint-define-config';
2
+ export declare const javascript: () => FlatESLintConfig[];
@@ -1,2 +1,2 @@
1
- import type { FlatESLintConfigItem } from 'eslint-define-config';
2
- export declare const jsonc: () => FlatESLintConfigItem[];
1
+ import type { FlatESLintConfig } from 'eslint-define-config';
2
+ export declare const jsonc: () => FlatESLintConfig[];
@@ -1,2 +1,2 @@
1
- import type { FlatESLintConfigItem } from 'eslint-define-config';
2
- export declare const markdown: () => FlatESLintConfigItem[];
1
+ import type { FlatESLintConfig } from 'eslint-define-config';
2
+ export declare const markdown: () => FlatESLintConfig[];
@@ -1,2 +1,2 @@
1
- import type { FlatESLintConfigItem } from 'eslint-define-config';
2
- export declare const next: () => FlatESLintConfigItem[];
1
+ import type { FlatESLintConfig } from 'eslint-define-config';
2
+ export declare const next: () => FlatESLintConfig[];
@@ -1,2 +1,2 @@
1
- import type { FlatESLintConfigItem } from 'eslint-define-config';
2
- export declare const progress: () => FlatESLintConfigItem[];
1
+ import type { FlatESLintConfig } from 'eslint-define-config';
2
+ export declare const progress: () => FlatESLintConfig[];
@@ -1,2 +1,3 @@
1
- import type { FlatESLintConfigItem } from 'eslint-define-config';
2
- export declare const react: () => FlatESLintConfigItem[];
1
+ import type { FlatESLintConfig } from 'eslint-define-config';
2
+ export declare const react: () => FlatESLintConfig[];
3
+ export declare const ssrReact: () => FlatESLintConfig[];
@@ -0,0 +1,2 @@
1
+ import type { FlatESLintConfig } from 'eslint-define-config';
2
+ export declare const regexp: () => FlatESLintConfig[];
@@ -0,0 +1,2 @@
1
+ import type { FlatESLintConfig } from 'eslint-define-config';
2
+ export declare const stylistic: () => FlatESLintConfig[];
@@ -1,2 +1,2 @@
1
- import type { FlatESLintConfigItem } from 'eslint-define-config';
2
- export declare const tailwindcss: () => FlatESLintConfigItem[];
1
+ import type { FlatESLintConfig } from 'eslint-define-config';
2
+ export declare const tailwindcss: () => FlatESLintConfig[];
@@ -1,2 +1,2 @@
1
- import type { FlatESLintConfigItem } from 'eslint-define-config';
2
- export declare const typescript: () => FlatESLintConfigItem[];
1
+ import type { FlatESLintConfig } from 'eslint-define-config';
2
+ export declare const typescript: () => FlatESLintConfig[];
@@ -1,2 +1,2 @@
1
- import type { FlatESLintConfigItem } from 'eslint-define-config';
2
- export declare const unicorn: () => FlatESLintConfigItem[];
1
+ import type { FlatESLintConfig } from 'eslint-define-config';
2
+ export declare const unicorn: () => FlatESLintConfig[];
@@ -1,2 +1,2 @@
1
- import type { FlatESLintConfigItem } from 'eslint-define-config';
2
- export declare const yml: () => FlatESLintConfigItem[];
1
+ import type { FlatESLintConfig } from 'eslint-define-config';
2
+ export declare const yml: () => FlatESLintConfig[];
package/dts/index.d.ts CHANGED
@@ -1,2 +1,7 @@
1
- import type { FlatESLintConfigItem } from 'eslint-define-config';
2
- export declare const aiou: (config?: FlatESLintConfigItem | FlatESLintConfigItem[]) => FlatESLintConfigItem[];
1
+ import type { FlatESLintConfig } from 'eslint-define-config';
2
+ interface Options {
3
+ ssr?: boolean;
4
+ regexp?: boolean;
5
+ }
6
+ export declare const aiou: ({ ssr, regexp }?: Options, config?: FlatESLintConfig | FlatESLintConfig[]) => FlatESLintConfig[];
7
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiou/eslint-config",
3
- "version": "1.0.6",
3
+ "version": "1.2.0",
4
4
  "description": "eslint config for aiou template",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -26,13 +26,14 @@
26
26
  "access": "public"
27
27
  },
28
28
  "peerDependencies": {
29
- "eslint": ">=7.4.0 || ^8"
29
+ "eslint": ">=7.4.0 || ^8.53.0"
30
30
  },
31
31
  "dependencies": {
32
32
  "@next/eslint-plugin-next": "^13.1.4",
33
+ "@stylistic/eslint-plugin": "^1.4.1",
33
34
  "@typescript-eslint/eslint-plugin": "^6.9.0",
34
35
  "@typescript-eslint/parser": "^6.9.0",
35
- "eslint-define-config": "^1.24.1",
36
+ "eslint-define-config": "^2.0.0",
36
37
  "eslint-plugin-eslint-comments": "^3.2.0",
37
38
  "eslint-plugin-etc": "^2.0.3",
38
39
  "eslint-plugin-i": "^2.28.1",
@@ -55,7 +56,7 @@
55
56
  "jsonc-eslint-parser": "^2.4.0",
56
57
  "local-pkg": "^0.4.3",
57
58
  "yaml-eslint-parser": "^1.2.2",
58
- "@aiou/eslint-ignore": "0.5.1",
59
+ "@aiou/eslint-ignore": "0.5.2",
59
60
  "@aiou/eslint-plugin-progress": "0.3.1"
60
61
  },
61
62
  "devDependencies": {