@jsse/eslint-config 0.1.7 → 0.1.8

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
@@ -2806,6 +2806,7 @@ __export(src_exports, {
2806
2806
  GLOB_SRC_EXT: () => GLOB_SRC_EXT,
2807
2807
  GLOB_STYLE: () => GLOB_STYLE,
2808
2808
  GLOB_TESTS: () => GLOB_TESTS,
2809
+ GLOB_TOML: () => GLOB_TOML,
2809
2810
  GLOB_TS: () => GLOB_TS,
2810
2811
  GLOB_TSX: () => GLOB_TSX,
2811
2812
  GLOB_YAML: () => GLOB_YAML,
@@ -9752,6 +9753,7 @@ var GLOB_SCSS = "**/*.scss";
9752
9753
  var GLOB_JSON = "**/*.json";
9753
9754
  var GLOB_JSON5 = "**/*.json5";
9754
9755
  var GLOB_JSONC = "**/*.jsonc";
9756
+ var GLOB_TOML = "**/*.toml";
9755
9757
  var GLOB_MARKDOWN = "**/*.md";
9756
9758
  var GLOB_YAML = "**/*.y?(a)ml";
9757
9759
  var GLOB_HTML = "**/*.htm?(l)";
@@ -9844,12 +9846,12 @@ function isInEditor() {
9844
9846
 
9845
9847
  // src/plugins.ts
9846
9848
  var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
9849
+ var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
9847
9850
  var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
9848
9851
  var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
9852
+ var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
9849
9853
  var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
9850
9854
  var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
9851
- var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
9852
- var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
9853
9855
  var import_eslint_plugin = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
9854
9856
  var parserTs = __toESM(require("@typescript-eslint/parser"), 1);
9855
9857
  var pluginSortKeys = __toESM(require_eslint_plugin_sort_keys(), 1);
@@ -9969,915 +9971,916 @@ var antfu = async () => {
9969
9971
  ];
9970
9972
  };
9971
9973
 
9972
- // src/configs/ts/typescript-rules.ts
9973
- function typescriptRulesTypeAware() {
9974
- return {
9975
- "@typescript-eslint/await-thenable": "error",
9976
- "@typescript-eslint/no-for-in-array": "error",
9977
- "no-implied-eval": "off",
9978
- "@typescript-eslint/consistent-type-exports": [
9979
- "error",
9980
- {
9981
- fixMixedExportsWithInlineTypeSpecifier: true
9982
- }
9983
- ],
9984
- "dot-notation": "off",
9985
- "@typescript-eslint/dot-notation": [
9986
- "error",
9987
- {
9988
- allowPattern: "^_",
9989
- allowKeywords: true
9990
- }
9991
- ],
9992
- "@typescript-eslint/no-implied-eval": "error",
9993
- "@typescript-eslint/no-misused-promises": "error",
9994
- "@typescript-eslint/no-unnecessary-qualifier": "error",
9995
- "@typescript-eslint/no-unnecessary-type-arguments": "off",
9996
- "@typescript-eslint/no-unnecessary-type-assertion": "error",
9997
- "@typescript-eslint/no-useless-template-literals": "error",
9998
- "no-throw-literal": "off",
9999
- "@typescript-eslint/no-throw-literal": "error",
10000
- "@typescript-eslint/no-unsafe-argument": "error",
10001
- "@typescript-eslint/no-unsafe-assignment": "error",
10002
- "@typescript-eslint/no-unsafe-call": "error",
10003
- "@typescript-eslint/no-unsafe-member-access": "error",
10004
- "@typescript-eslint/no-unsafe-return": "error",
10005
- "@typescript-eslint/restrict-plus-operands": "error",
10006
- "@typescript-eslint/restrict-template-expressions": "error",
10007
- "@typescript-eslint/unbound-method": "error",
10008
- "@typescript-eslint/naming-convention": [
10009
- "error",
10010
- {
10011
- selector: ["variable"],
10012
- modifiers: ["global"],
10013
- format: ["camelCase", "snake_case", "UPPER_CASE", "PascalCase"],
10014
- leadingUnderscore: "allowSingleOrDouble",
10015
- trailingUnderscore: "allow",
10016
- filter: {
10017
- regex: "[- ]",
10018
- match: false
10019
- }
10020
- },
10021
- {
10022
- selector: [
10023
- "classProperty",
10024
- "objectLiteralProperty",
10025
- "typeProperty",
10026
- "classMethod",
10027
- "objectLiteralMethod",
10028
- "typeMethod",
10029
- "accessor",
10030
- "enumMember"
10031
- ],
10032
- // eslint-disable-next-line unicorn/no-null
10033
- format: null,
10034
- modifiers: ["requiresQuotes"]
10035
- },
10036
- {
10037
- selector: [
10038
- "variable",
10039
- "function",
10040
- "classProperty",
10041
- "objectLiteralProperty",
10042
- "parameterProperty",
10043
- "classMethod",
10044
- "objectLiteralMethod",
10045
- "typeMethod",
10046
- "accessor"
10047
- ],
10048
- format: ["camelCase", "snake_case", "PascalCase"],
10049
- leadingUnderscore: "allowSingleOrDouble",
10050
- trailingUnderscore: "allow",
10051
- filter: {
10052
- // also allow when '/' is in object key
10053
- regex: "^[0-9]|[- ]|[/]",
10054
- match: false
10055
- }
9974
+ // src/configs/comments.ts
9975
+ var comments = async () => [
9976
+ {
9977
+ name: "jsse:eslint-comments",
9978
+ plugins: {
9979
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
9980
+ "eslint-comments": import_eslint_plugin_eslint_comments.default
9981
+ },
9982
+ rules: {
9983
+ "eslint-comments/no-aggregating-enable": "error",
9984
+ "eslint-comments/no-duplicate-disable": "error",
9985
+ "eslint-comments/no-unlimited-disable": "error",
9986
+ "eslint-comments/no-unused-enable": "error"
9987
+ }
9988
+ }
9989
+ ];
9990
+
9991
+ // src/configs/ignores.ts
9992
+ var ignores = async () => {
9993
+ return [
9994
+ {
9995
+ ignores: GLOB_EXCLUDE
9996
+ }
9997
+ ];
9998
+ };
9999
+
10000
+ // src/configs/imports.ts
10001
+ var imports = async (options) => {
10002
+ const { stylistic: stylistic2 = true } = options ?? {};
10003
+ return [
10004
+ {
10005
+ name: "jsse:import",
10006
+ plugins: {
10007
+ import: pluginImport
10056
10008
  },
10057
- {
10058
- selector: "typeLike",
10059
- format: ["PascalCase"]
10009
+ rules: {
10010
+ "import/first": "error",
10011
+ "import/no-duplicates": "error",
10012
+ "import/no-mutable-exports": "error",
10013
+ "import/no-named-default": "error",
10014
+ "import/no-self-import": "error",
10015
+ "import/no-webpack-loader-syntax": "error",
10016
+ "import/order": "error",
10017
+ ...stylistic2 ? {
10018
+ "import/newline-after-import": [
10019
+ "error",
10020
+ { considerComments: true, count: 1 }
10021
+ ]
10022
+ } : {}
10023
+ }
10024
+ }
10025
+ ];
10026
+ };
10027
+
10028
+ // src/configs/javascript.ts
10029
+ var import_js = __toESM(require("@eslint/js"), 1);
10030
+ var import_globals = __toESM(require_globals2(), 1);
10031
+ var javascript = async (options) => {
10032
+ const {
10033
+ isInEditor: isInEditor2 = false,
10034
+ overrides = {},
10035
+ reportUnusedDisableDirectives = true
10036
+ } = options ?? {};
10037
+ return [
10038
+ {
10039
+ languageOptions: {
10040
+ ecmaVersion: 2022,
10041
+ globals: {
10042
+ ...import_globals.default.browser,
10043
+ ...import_globals.default.es2021,
10044
+ ...import_globals.default.node,
10045
+ document: "readonly",
10046
+ navigator: "readonly",
10047
+ window: "readonly"
10048
+ },
10049
+ parserOptions: {
10050
+ ecmaFeatures: {
10051
+ jsx: true
10052
+ },
10053
+ ecmaVersion: 2022,
10054
+ sourceType: "module"
10055
+ },
10056
+ sourceType: "module"
10060
10057
  },
10061
- {
10062
- selector: "variable",
10063
- types: ["boolean"],
10064
- format: ["PascalCase", "camelCase"],
10065
- prefix: ["is", "has", "can", "should", "will", "did"]
10058
+ linterOptions: {
10059
+ reportUnusedDisableDirectives
10066
10060
  },
10067
- {
10068
- selector: "interface",
10069
- format: ["PascalCase"]
10061
+ name: "jsse:javascript",
10062
+ plugins: {
10063
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
10064
+ "unused-imports": import_eslint_plugin_unused_imports.default
10070
10065
  },
10071
- {
10072
- selector: "typeParameter",
10073
- filter: "^T$|^[A-Z][a-zA-Z]+$",
10074
- format: ["PascalCase"]
10075
- }
10076
- ],
10077
- "@typescript-eslint/no-floating-promises": [
10078
- "error",
10079
- {
10080
- ignoreVoid: true,
10081
- ignoreIIFE: true
10082
- }
10083
- ]
10084
- };
10085
- }
10086
- function typescriptRulesTypeOblivious() {
10087
- return {
10088
- eqeqeq: "error",
10089
- camelcase: "off",
10090
- yoda: "error",
10091
- "arrow-parens": "off",
10092
- "no-console": [
10093
- "warn",
10094
- {
10095
- allow: [
10096
- "log",
10097
- "warn",
10098
- "dir",
10099
- "time",
10100
- "timeEnd",
10101
- "timeLog",
10102
- "trace",
10103
- "assert",
10104
- "clear",
10105
- "count",
10106
- "countReset",
10107
- "group",
10108
- "groupEnd",
10109
- "table",
10110
- "debug",
10111
- "info",
10112
- "dirxml",
10066
+ rules: {
10067
+ ...import_js.default.configs.recommended.rules,
10068
+ "accessor-pairs": [
10113
10069
  "error",
10114
- "groupCollapsed",
10115
- "Console",
10116
- "profile",
10117
- "profileEnd",
10118
- "timeStamp",
10119
- "context"
10120
- ]
10121
- }
10122
- ],
10123
- "object-curly-spacing": "off",
10124
- "@typescript-eslint/object-curly-spacing": "off",
10125
- "@typescript-eslint/no-inferrable-types": "off",
10126
- "@typescript-eslint/prefer-ts-expect-error": "error",
10127
- "@typescript-eslint/consistent-type-imports": [
10128
- "error",
10129
- {
10130
- prefer: "type-imports",
10131
- fixStyle: "separate-type-imports"
10132
- }
10133
- ],
10134
- "@typescript-eslint/adjacent-overload-signatures": "error",
10135
- "@typescript-eslint/ban-types": [
10136
- "warn",
10137
- {
10138
- extendDefaults: false,
10139
- types: {
10140
- String: {
10141
- message: 'Use "string" instead',
10142
- fixWith: "string"
10143
- },
10144
- Boolean: {
10145
- message: 'Use "boolean" instead',
10146
- fixWith: "boolean"
10147
- },
10148
- Number: {
10149
- message: 'Use "number" instead',
10150
- fixWith: "number"
10151
- },
10152
- BigInt: {
10153
- message: "Use `bigint` instead.",
10154
- fixWith: "bigint"
10155
- },
10156
- Object: {
10157
- message: "The `Object` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead. See https://github.com/typescript-eslint/typescript-eslint/pull/848",
10158
- fixWith: "Record<string, unknown>"
10159
- },
10160
- object: {
10161
- message: "The `object` type is hard to use. Use `Record<string, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848",
10162
- fixWith: "Record<string, unknown>"
10070
+ { enforceForClassMembers: true, setWithoutGet: true }
10071
+ ],
10072
+ "array-callback-return": "error",
10073
+ "arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
10074
+ "block-scoped-var": "error",
10075
+ "constructor-super": "error",
10076
+ "default-case-last": "error",
10077
+ "dot-notation": ["error", { allowKeywords: true }],
10078
+ eqeqeq: ["error", "smart"],
10079
+ "new-cap": [
10080
+ "error",
10081
+ { capIsNew: false, newIsCap: true, properties: true }
10082
+ ],
10083
+ "no-alert": "error",
10084
+ "no-array-constructor": "error",
10085
+ "no-async-promise-executor": "error",
10086
+ "no-caller": "error",
10087
+ "no-case-declarations": "error",
10088
+ "no-class-assign": "error",
10089
+ "no-compare-neg-zero": "error",
10090
+ "no-cond-assign": ["error", "always"],
10091
+ "no-console": ["error", { allow: ["warn", "error"] }],
10092
+ "no-const-assign": "error",
10093
+ "no-control-regex": "error",
10094
+ "no-debugger": "error",
10095
+ "no-delete-var": "error",
10096
+ "no-dupe-args": "error",
10097
+ "no-dupe-class-members": "error",
10098
+ "no-dupe-keys": "error",
10099
+ "no-duplicate-case": "error",
10100
+ "no-empty": ["error", { allowEmptyCatch: true }],
10101
+ "no-empty-character-class": "error",
10102
+ "no-empty-pattern": "error",
10103
+ "no-eval": "error",
10104
+ "no-ex-assign": "error",
10105
+ "no-extend-native": "error",
10106
+ "no-extra-bind": "error",
10107
+ "no-extra-boolean-cast": "error",
10108
+ "no-fallthrough": "error",
10109
+ "no-func-assign": "error",
10110
+ "no-global-assign": "error",
10111
+ "no-implied-eval": "error",
10112
+ "no-import-assign": "error",
10113
+ "no-invalid-regexp": "error",
10114
+ "no-invalid-this": "error",
10115
+ "no-irregular-whitespace": "error",
10116
+ "no-iterator": "error",
10117
+ "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
10118
+ "no-lone-blocks": "error",
10119
+ "no-loss-of-precision": "error",
10120
+ "no-misleading-character-class": "error",
10121
+ "no-multi-str": "error",
10122
+ "no-nested-ternary": "off",
10123
+ "no-new": "error",
10124
+ "no-new-func": "error",
10125
+ "no-new-object": "error",
10126
+ "no-new-symbol": "error",
10127
+ "no-new-wrappers": "error",
10128
+ "no-obj-calls": "error",
10129
+ "no-octal": "error",
10130
+ "no-octal-escape": "error",
10131
+ "no-proto": "error",
10132
+ "no-prototype-builtins": "error",
10133
+ "no-redeclare": ["error", { builtinGlobals: false }],
10134
+ "no-regex-spaces": "error",
10135
+ "no-restricted-globals": [
10136
+ "error",
10137
+ { message: "Use `globalThis` instead.", name: "global" },
10138
+ { message: "Use `globalThis` instead.", name: "self" }
10139
+ ],
10140
+ "no-restricted-properties": [
10141
+ "error",
10142
+ {
10143
+ message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
10144
+ property: "__proto__"
10163
10145
  },
10164
- Symbol: {
10165
- message: 'Use "symbol" instead',
10166
- fixWith: "symbol"
10146
+ {
10147
+ message: "Use `Object.defineProperty` instead.",
10148
+ property: "__defineGetter__"
10167
10149
  },
10168
- Function: {
10169
- message: 'The "Function" type accepts any function-like value.\nIt provides no type safety when calling the function, which can be a common source of bugs.\nIt also accepts things like class declarations, which will throw at runtime as they will not be called with "new".\nIf you are expecting the function to accept certain arguments, you should explicitly define the function shape.'
10150
+ {
10151
+ message: "Use `Object.defineProperty` instead.",
10152
+ property: "__defineSetter__"
10170
10153
  },
10171
- // eslint-disable-next-line @typescript-eslint/naming-convention
10172
- "{}": {
10173
- message: "The `{}` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead.",
10174
- fixWith: "Record<string, unknown>"
10154
+ {
10155
+ message: "Use `Object.getOwnPropertyDescriptor` instead.",
10156
+ property: "__lookupGetter__"
10175
10157
  },
10176
- // eslint-disable-next-line @typescript-eslint/naming-convention
10177
- "[]": "Don't use the empty array type `[]`. It only allows empty arrays. Use `SomeType[]` instead.",
10178
- // eslint-disable-next-line @typescript-eslint/naming-convention
10179
- "[[]]": "Don't use `[[]]`. It only allows an array with a single element which is an empty array. Use `SomeType[][]` instead.",
10180
- // eslint-disable-next-line @typescript-eslint/naming-convention
10181
- "[[[]]]": "Don't use `[[[]]]`. Use `SomeType[][][]` instead."
10182
- }
10183
- }
10184
- ],
10185
- "@typescript-eslint/consistent-type-assertions": "error",
10186
- "@typescript-eslint/consistent-type-definitions": ["error", "type"],
10187
- "@typescript-eslint/member-ordering": [
10188
- "warn",
10189
- {
10190
- default: "never",
10191
- classes: ["field", "constructor", "method"]
10158
+ {
10159
+ message: "Use `Object.getOwnPropertyDescriptor` instead.",
10160
+ property: "__lookupSetter__"
10161
+ }
10162
+ ],
10163
+ "no-restricted-syntax": [
10164
+ "error",
10165
+ "DebuggerStatement",
10166
+ "LabeledStatement",
10167
+ "WithStatement",
10168
+ "TSEnumDeclaration[const=true]",
10169
+ "TSExportAssignment"
10170
+ ],
10171
+ "no-self-assign": ["error", { props: true }],
10172
+ "no-self-compare": "error",
10173
+ "no-sequences": "error",
10174
+ "no-shadow-restricted-names": "error",
10175
+ "no-sparse-arrays": "error",
10176
+ "no-template-curly-in-string": "error",
10177
+ "no-this-before-super": "error",
10178
+ "no-throw-literal": "error",
10179
+ "no-undef": "error",
10180
+ "no-undef-init": "error",
10181
+ "no-unexpected-multiline": "error",
10182
+ "no-unmodified-loop-condition": "error",
10183
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
10184
+ "no-unreachable": "error",
10185
+ "no-unreachable-loop": "error",
10186
+ "no-unsafe-finally": "error",
10187
+ "no-unsafe-negation": "error",
10188
+ "no-unused-expressions": [
10189
+ "error",
10190
+ {
10191
+ allowShortCircuit: true,
10192
+ allowTaggedTemplates: true,
10193
+ allowTernary: true
10194
+ }
10195
+ ],
10196
+ "no-unused-vars": [
10197
+ "error",
10198
+ {
10199
+ args: "none",
10200
+ caughtErrors: "none",
10201
+ ignoreRestSiblings: true,
10202
+ vars: "all"
10203
+ }
10204
+ ],
10205
+ "no-use-before-define": [
10206
+ "error",
10207
+ { classes: false, functions: false, variables: true }
10208
+ ],
10209
+ "no-useless-backreference": "error",
10210
+ "no-useless-call": "error",
10211
+ "no-useless-catch": "error",
10212
+ "no-useless-computed-key": "error",
10213
+ "no-useless-constructor": "error",
10214
+ "no-useless-rename": "error",
10215
+ "no-useless-return": "error",
10216
+ "no-var": "error",
10217
+ "no-with": "error",
10218
+ "object-shorthand": [
10219
+ "error",
10220
+ "always",
10221
+ {
10222
+ avoidQuotes: true,
10223
+ ignoreConstructors: false
10224
+ }
10225
+ ],
10226
+ "one-var": ["error", { initialized: "never" }],
10227
+ "prefer-arrow-callback": [
10228
+ "error",
10229
+ {
10230
+ allowNamedFunctions: false,
10231
+ allowUnboundThis: true
10232
+ }
10233
+ ],
10234
+ "prefer-const": [
10235
+ "error",
10236
+ {
10237
+ destructuring: "all",
10238
+ ignoreReadBeforeAssign: true
10239
+ }
10240
+ ],
10241
+ "prefer-exponentiation-operator": "error",
10242
+ "prefer-promise-reject-errors": "error",
10243
+ "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
10244
+ "prefer-rest-params": "error",
10245
+ "prefer-spread": "error",
10246
+ "prefer-template": "error",
10247
+ "sort-imports": [
10248
+ "error",
10249
+ {
10250
+ allowSeparatedGroups: false,
10251
+ ignoreCase: false,
10252
+ ignoreDeclarationSort: true,
10253
+ ignoreMemberSort: false,
10254
+ memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
10255
+ }
10256
+ ],
10257
+ "symbol-description": "error",
10258
+ "unicode-bom": ["error", "never"],
10259
+ "unused-imports/no-unused-imports": isInEditor2 ? "off" : "error",
10260
+ "unused-imports/no-unused-vars": [
10261
+ "error",
10262
+ {
10263
+ args: "after-used",
10264
+ argsIgnorePattern: "^_",
10265
+ vars: "all",
10266
+ varsIgnorePattern: "^_"
10267
+ }
10268
+ ],
10269
+ "use-isnan": [
10270
+ "error",
10271
+ { enforceForIndexOf: true, enforceForSwitchCase: true }
10272
+ ],
10273
+ "valid-typeof": ["error", { requireStringLiterals: true }],
10274
+ "vars-on-top": "error",
10275
+ yoda: ["error", "never"],
10276
+ ...overrides
10192
10277
  }
10193
- ],
10194
- "no-array-constructor": "off",
10195
- "@typescript-eslint/no-array-constructor": "error",
10196
- "@typescript-eslint/no-explicit-any": "error",
10197
- "@typescript-eslint/no-misused-new": "error",
10198
- "@typescript-eslint/no-namespace": [
10278
+ },
10279
+ {
10280
+ files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
10281
+ name: "jsse:scripts-overrides",
10282
+ rules: {
10283
+ "no-console": "off"
10284
+ }
10285
+ }
10286
+ ];
10287
+ };
10288
+
10289
+ // src/configs/jsdoc.ts
10290
+ var jsdoc = async () => {
10291
+ const { pluginJsdoc } = await importPluginJsdoc();
10292
+ return [
10293
+ {
10294
+ name: "jsse:jsdoc",
10295
+ plugins: {
10296
+ jsdoc: pluginJsdoc
10297
+ },
10298
+ rules: {
10299
+ "jsdoc/check-access": "warn",
10300
+ "jsdoc/check-alignment": "warn",
10301
+ "jsdoc/check-param-names": "warn",
10302
+ "jsdoc/check-property-names": "warn",
10303
+ "jsdoc/check-types": "warn",
10304
+ "jsdoc/empty-tags": "warn",
10305
+ "jsdoc/implements-on-classes": "warn",
10306
+ "jsdoc/multiline-blocks": "warn",
10307
+ "jsdoc/no-defaults": "warn",
10308
+ "jsdoc/no-multi-asterisks": "warn",
10309
+ "jsdoc/require-param-name": "warn",
10310
+ "jsdoc/require-property": "warn",
10311
+ "jsdoc/require-property-description": "warn",
10312
+ "jsdoc/require-property-name": "warn",
10313
+ "jsdoc/require-returns-check": "warn",
10314
+ "jsdoc/require-returns-description": "warn",
10315
+ "jsdoc/require-yields-check": "warn"
10316
+ }
10317
+ }
10318
+ ];
10319
+ };
10320
+
10321
+ // src/configs/jsonc.ts
10322
+ var jsonc = async (options) => {
10323
+ const { overrides = {}, stylistic: stylistic2 = true } = options ?? {};
10324
+ const { indent = 2 } = typeof stylistic2 === "boolean" ? {} : stylistic2;
10325
+ const { parserJsonc, pluginJsonc } = await importJsoncLibs();
10326
+ return [
10327
+ {
10328
+ name: "jsse:jsonc:setup",
10329
+ plugins: {
10330
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any
10331
+ jsonc: pluginJsonc
10332
+ }
10333
+ },
10334
+ {
10335
+ files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
10336
+ ignores: ["*.min.json"],
10337
+ languageOptions: {
10338
+ parser: parserJsonc
10339
+ },
10340
+ name: "jsse:jsonc:rules",
10341
+ rules: {
10342
+ "jsonc/no-bigint-literals": "error",
10343
+ "jsonc/no-binary-expression": "error",
10344
+ "jsonc/no-binary-numeric-literals": "error",
10345
+ "jsonc/no-dupe-keys": "error",
10346
+ "jsonc/no-escape-sequence-in-identifier": "error",
10347
+ "jsonc/no-floating-decimal": "error",
10348
+ "jsonc/no-hexadecimal-numeric-literals": "error",
10349
+ "jsonc/no-infinity": "error",
10350
+ "jsonc/no-multi-str": "error",
10351
+ "jsonc/no-nan": "error",
10352
+ "jsonc/no-number-props": "error",
10353
+ "jsonc/no-numeric-separators": "error",
10354
+ "jsonc/no-octal": "error",
10355
+ "jsonc/no-octal-escape": "error",
10356
+ "jsonc/no-octal-numeric-literals": "error",
10357
+ "jsonc/no-parenthesized": "error",
10358
+ "jsonc/no-plus-sign": "error",
10359
+ "jsonc/no-regexp-literals": "error",
10360
+ "jsonc/no-sparse-arrays": "error",
10361
+ "jsonc/no-template-literals": "error",
10362
+ "jsonc/no-undefined-value": "error",
10363
+ "jsonc/no-unicode-codepoint-escapes": "error",
10364
+ "jsonc/no-useless-escape": "error",
10365
+ "jsonc/space-unary-ops": "error",
10366
+ "jsonc/valid-json-number": "error",
10367
+ "jsonc/vue-custom-block/no-parsing-error": "error",
10368
+ ...stylistic2 ? {
10369
+ "jsonc/array-bracket-spacing": ["error", "never"],
10370
+ "jsonc/comma-dangle": ["error", "never"],
10371
+ "jsonc/comma-style": ["error", "last"],
10372
+ "jsonc/indent": ["error", indent],
10373
+ "jsonc/key-spacing": [
10374
+ "error",
10375
+ { afterColon: true, beforeColon: false }
10376
+ ],
10377
+ "jsonc/object-curly-newline": [
10378
+ "error",
10379
+ { consistent: true, multiline: true }
10380
+ ],
10381
+ "jsonc/object-curly-spacing": ["error", "always"],
10382
+ "jsonc/object-property-newline": [
10383
+ "error",
10384
+ { allowMultiplePropertiesPerLine: true }
10385
+ ],
10386
+ "jsonc/quote-props": "error",
10387
+ "jsonc/quotes": "error"
10388
+ } : {},
10389
+ ...overrides
10390
+ }
10391
+ }
10392
+ ];
10393
+ };
10394
+
10395
+ // src/configs/ts/typescript-rules.ts
10396
+ function typescriptRulesTypeAware() {
10397
+ return {
10398
+ "@typescript-eslint/await-thenable": "error",
10399
+ "@typescript-eslint/no-for-in-array": "error",
10400
+ "no-implied-eval": "off",
10401
+ "@typescript-eslint/consistent-type-exports": [
10199
10402
  "error",
10200
10403
  {
10201
- allowDeclarations: false,
10202
- allowDefinitionFiles: false
10404
+ fixMixedExportsWithInlineTypeSpecifier: true
10203
10405
  }
10204
10406
  ],
10205
- "no-unused-vars": "off",
10206
- "@typescript-eslint/no-unused-vars": [
10207
- "warn",
10407
+ "dot-notation": "off",
10408
+ "@typescript-eslint/dot-notation": [
10409
+ "error",
10208
10410
  {
10209
- vars: "all",
10210
- args: "none",
10211
- argsIgnorePattern: "^_",
10212
- varsIgnorePattern: "^_",
10213
- caughtErrorsIgnorePattern: "^_"
10411
+ allowPattern: "^_",
10412
+ allowKeywords: true
10214
10413
  }
10215
10414
  ],
10216
- "no-use-before-define": "off",
10217
- "@typescript-eslint/no-use-before-define": [
10415
+ "@typescript-eslint/no-implied-eval": "error",
10416
+ "@typescript-eslint/no-misused-promises": "error",
10417
+ "@typescript-eslint/no-unnecessary-qualifier": "error",
10418
+ "@typescript-eslint/no-unnecessary-type-arguments": "off",
10419
+ "@typescript-eslint/no-unnecessary-type-assertion": "error",
10420
+ "@typescript-eslint/no-useless-template-literals": "error",
10421
+ "no-throw-literal": "off",
10422
+ "@typescript-eslint/no-throw-literal": "error",
10423
+ "@typescript-eslint/no-unsafe-argument": "error",
10424
+ "@typescript-eslint/no-unsafe-assignment": "error",
10425
+ "@typescript-eslint/no-unsafe-call": "error",
10426
+ "@typescript-eslint/no-unsafe-member-access": "error",
10427
+ "@typescript-eslint/no-unsafe-return": "error",
10428
+ "@typescript-eslint/restrict-plus-operands": "error",
10429
+ "@typescript-eslint/restrict-template-expressions": "error",
10430
+ "@typescript-eslint/unbound-method": "error",
10431
+ "@typescript-eslint/naming-convention": [
10218
10432
  "error",
10219
10433
  {
10220
- functions: true,
10221
- classes: true,
10222
- variables: true,
10223
- enums: true,
10224
- typedefs: true
10225
- }
10226
- ],
10227
- "@typescript-eslint/prefer-namespace-keyword": "warn",
10228
- "@typescript-eslint/typedef": [
10229
- "warn",
10434
+ selector: ["variable"],
10435
+ modifiers: ["global"],
10436
+ format: ["camelCase", "snake_case", "UPPER_CASE", "PascalCase"],
10437
+ leadingUnderscore: "allowSingleOrDouble",
10438
+ trailingUnderscore: "allow",
10439
+ filter: {
10440
+ regex: "[- ]",
10441
+ match: false
10442
+ }
10443
+ },
10230
10444
  {
10231
- arrayDestructuring: false,
10232
- arrowParameter: false,
10233
- memberVariableDeclaration: true,
10234
- objectDestructuring: false,
10235
- parameter: true,
10236
- propertyDeclaration: true,
10237
- variableDeclaration: false,
10238
- variableDeclarationIgnoreFunction: true
10239
- }
10240
- ],
10241
- "accessor-pairs": "error",
10242
- "for-direction": "warn",
10243
- "guard-for-in": "error",
10244
- "max-lines": [
10245
- "warn",
10445
+ selector: [
10446
+ "classProperty",
10447
+ "objectLiteralProperty",
10448
+ "typeProperty",
10449
+ "classMethod",
10450
+ "objectLiteralMethod",
10451
+ "typeMethod",
10452
+ "accessor",
10453
+ "enumMember"
10454
+ ],
10455
+ // eslint-disable-next-line unicorn/no-null
10456
+ format: null,
10457
+ modifiers: ["requiresQuotes"]
10458
+ },
10246
10459
  {
10247
- max: 2e3
10248
- }
10249
- ],
10250
- "no-async-promise-executor": "error",
10251
- "no-bitwise": [
10252
- "warn",
10460
+ selector: [
10461
+ "variable",
10462
+ "function",
10463
+ "classProperty",
10464
+ "objectLiteralProperty",
10465
+ "parameterProperty",
10466
+ "classMethod",
10467
+ "objectLiteralMethod",
10468
+ "typeMethod",
10469
+ "accessor"
10470
+ ],
10471
+ format: ["camelCase", "snake_case", "PascalCase"],
10472
+ leadingUnderscore: "allowSingleOrDouble",
10473
+ trailingUnderscore: "allow",
10474
+ filter: {
10475
+ // also allow when '/' is in object key
10476
+ regex: "^[0-9]|[- ]|[/]",
10477
+ match: false
10478
+ }
10479
+ },
10253
10480
  {
10254
- allow: ["^", "<<", ">>", ">>>", "^=", "<<=", ">>=", ">>>=", "~"]
10481
+ selector: "typeLike",
10482
+ format: ["PascalCase"]
10483
+ },
10484
+ {
10485
+ selector: "variable",
10486
+ types: ["boolean"],
10487
+ format: ["PascalCase", "camelCase"],
10488
+ prefix: ["is", "has", "can", "should", "will", "did"]
10489
+ },
10490
+ {
10491
+ selector: "interface",
10492
+ format: ["PascalCase"]
10493
+ },
10494
+ {
10495
+ selector: "typeParameter",
10496
+ filter: "^T$|^[A-Z][a-zA-Z]+$",
10497
+ format: ["PascalCase"]
10255
10498
  }
10256
10499
  ],
10257
- "no-caller": "error",
10258
- "no-compare-neg-zero": "error",
10259
- "no-cond-assign": "error",
10260
- "no-constant-condition": "warn",
10261
- "no-control-regex": "error",
10262
- "no-debugger": "warn",
10263
- "no-delete-var": "error",
10264
- "no-duplicate-case": "error",
10265
- "no-empty": "warn",
10266
- "no-empty-character-class": "error",
10267
- "no-empty-pattern": "warn",
10268
- "no-eval": "warn",
10269
- "no-ex-assign": "error",
10270
- "no-extend-native": "error",
10271
- "no-extra-boolean-cast": "warn",
10272
- "no-extra-label": "warn",
10273
- "no-fallthrough": "error",
10274
- "no-func-assign": "warn",
10275
- "no-implied-eval": "error",
10276
- "no-invalid-regexp": "error",
10277
- "no-label-var": "error",
10278
- "no-lone-blocks": "warn",
10279
- "no-misleading-character-class": "error",
10280
- "no-multi-str": "error",
10281
- "no-new": "warn",
10282
- "no-new-func": "error",
10283
- "no-new-wrappers": "warn",
10284
- "no-octal": "error",
10285
- "no-octal-escape": "error",
10286
- "no-regex-spaces": "error",
10287
- "no-return-assign": "error",
10288
- "no-script-url": "warn",
10289
- "no-self-assign": "error",
10290
- "no-self-compare": "error",
10291
- "no-sequences": "error",
10292
- "no-shadow-restricted-names": "error",
10293
- "no-sparse-arrays": "error",
10294
- "no-unmodified-loop-condition": "warn",
10295
- "no-unsafe-finally": "error",
10296
- "no-unused-expressions": "off",
10297
- "@typescript-eslint/no-unused-expressions": "error",
10298
- "no-unused-labels": "error",
10299
- "no-useless-catch": "warn",
10300
- "no-useless-concat": "error",
10301
- "no-var": "error",
10302
- "no-void": [
10500
+ "@typescript-eslint/no-floating-promises": [
10303
10501
  "error",
10304
10502
  {
10305
- allowAsStatement: true
10503
+ ignoreVoid: true,
10504
+ ignoreIIFE: true
10505
+ }
10506
+ ]
10507
+ };
10508
+ }
10509
+ function typescriptRulesTypeOblivious() {
10510
+ return {
10511
+ eqeqeq: "error",
10512
+ camelcase: "off",
10513
+ yoda: "error",
10514
+ "arrow-parens": "off",
10515
+ "no-console": [
10516
+ "warn",
10517
+ {
10518
+ allow: [
10519
+ "log",
10520
+ "warn",
10521
+ "dir",
10522
+ "time",
10523
+ "timeEnd",
10524
+ "timeLog",
10525
+ "trace",
10526
+ "assert",
10527
+ "clear",
10528
+ "count",
10529
+ "countReset",
10530
+ "group",
10531
+ "groupEnd",
10532
+ "table",
10533
+ "debug",
10534
+ "info",
10535
+ "dirxml",
10536
+ "error",
10537
+ "groupCollapsed",
10538
+ "Console",
10539
+ "profile",
10540
+ "profileEnd",
10541
+ "timeStamp",
10542
+ "context"
10543
+ ]
10306
10544
  }
10307
10545
  ],
10308
- "no-with": "error",
10309
- "prefer-const": "error",
10310
- "require-atomic-updates": "error",
10311
- "require-yield": "warn",
10312
- strict: ["error", "never"],
10313
- "use-isnan": "error",
10314
- "no-useless-constructor": "off",
10315
- "@typescript-eslint/no-useless-constructor": "error",
10316
- "@typescript-eslint/no-unnecessary-type-constraint": "error",
10317
- "@typescript-eslint/brace-style": [
10546
+ "object-curly-spacing": "off",
10547
+ "@typescript-eslint/object-curly-spacing": "off",
10548
+ "@typescript-eslint/no-inferrable-types": "off",
10549
+ "@typescript-eslint/prefer-ts-expect-error": "error",
10550
+ "@typescript-eslint/consistent-type-imports": [
10318
10551
  "error",
10319
- "1tbs",
10320
10552
  {
10321
- allowSingleLine: false
10553
+ prefer: "type-imports",
10554
+ fixStyle: "separate-type-imports"
10322
10555
  }
10323
10556
  ],
10324
- "comma-spacing": "off",
10325
- "@typescript-eslint/comma-spacing": [
10326
- "error",
10557
+ "@typescript-eslint/adjacent-overload-signatures": "error",
10558
+ "@typescript-eslint/ban-types": [
10559
+ "warn",
10327
10560
  {
10328
- before: false,
10329
- after: true
10561
+ extendDefaults: false,
10562
+ types: {
10563
+ String: {
10564
+ message: 'Use "string" instead',
10565
+ fixWith: "string"
10566
+ },
10567
+ Boolean: {
10568
+ message: 'Use "boolean" instead',
10569
+ fixWith: "boolean"
10570
+ },
10571
+ Number: {
10572
+ message: 'Use "number" instead',
10573
+ fixWith: "number"
10574
+ },
10575
+ BigInt: {
10576
+ message: "Use `bigint` instead.",
10577
+ fixWith: "bigint"
10578
+ },
10579
+ Object: {
10580
+ message: "The `Object` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead. See https://github.com/typescript-eslint/typescript-eslint/pull/848",
10581
+ fixWith: "Record<string, unknown>"
10582
+ },
10583
+ object: {
10584
+ message: "The `object` type is hard to use. Use `Record<string, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848",
10585
+ fixWith: "Record<string, unknown>"
10586
+ },
10587
+ Symbol: {
10588
+ message: 'Use "symbol" instead',
10589
+ fixWith: "symbol"
10590
+ },
10591
+ Function: {
10592
+ message: 'The "Function" type accepts any function-like value.\nIt provides no type safety when calling the function, which can be a common source of bugs.\nIt also accepts things like class declarations, which will throw at runtime as they will not be called with "new".\nIf you are expecting the function to accept certain arguments, you should explicitly define the function shape.'
10593
+ },
10594
+ // eslint-disable-next-line @typescript-eslint/naming-convention
10595
+ "{}": {
10596
+ message: "The `{}` type is mostly the same as `unknown`. You probably want `Record<string, unknown>` instead.",
10597
+ fixWith: "Record<string, unknown>"
10598
+ },
10599
+ // eslint-disable-next-line @typescript-eslint/naming-convention
10600
+ "[]": "Don't use the empty array type `[]`. It only allows empty arrays. Use `SomeType[]` instead.",
10601
+ // eslint-disable-next-line @typescript-eslint/naming-convention
10602
+ "[[]]": "Don't use `[[]]`. It only allows an array with a single element which is an empty array. Use `SomeType[][]` instead.",
10603
+ // eslint-disable-next-line @typescript-eslint/naming-convention
10604
+ "[[[]]]": "Don't use `[[[]]]`. Use `SomeType[][][]` instead."
10605
+ }
10330
10606
  }
10331
10607
  ],
10332
- "default-param-last": "off",
10333
- "@typescript-eslint/default-param-last": "error",
10334
- "func-call-spacing": "off",
10335
- "@typescript-eslint/func-call-spacing": ["error", "never"],
10336
- "keyword-spacing": "off",
10337
- "@typescript-eslint/keyword-spacing": "error",
10338
- "lines-between-class-members": "off",
10339
- "@typescript-eslint/lines-between-class-members": [
10608
+ "@typescript-eslint/consistent-type-assertions": "error",
10609
+ "@typescript-eslint/consistent-type-definitions": ["error", "type"],
10610
+ "@typescript-eslint/member-ordering": [
10611
+ "warn",
10612
+ {
10613
+ default: "never",
10614
+ classes: ["field", "constructor", "method"]
10615
+ }
10616
+ ],
10617
+ "no-array-constructor": "off",
10618
+ "@typescript-eslint/no-array-constructor": "error",
10619
+ "@typescript-eslint/no-explicit-any": "error",
10620
+ "@typescript-eslint/no-misused-new": "error",
10621
+ "@typescript-eslint/no-namespace": [
10340
10622
  "error",
10341
- "always",
10342
10623
  {
10343
- exceptAfterSingleLine: true
10624
+ allowDeclarations: false,
10625
+ allowDefinitionFiles: false
10344
10626
  }
10345
10627
  ],
10346
- "no-dupe-class-members": "off",
10347
- "@typescript-eslint/no-dupe-class-members": "error",
10348
- "no-empty-function": "off",
10349
- "@typescript-eslint/no-empty-function": "error",
10350
- "no-extra-parens": "off",
10351
- "no-extra-semi": "off",
10352
- "@typescript-eslint/no-extra-semi": "error",
10353
- "no-loop-func": "off",
10354
- "@typescript-eslint/no-loop-func": "error",
10355
- "no-loss-of-precision": "off",
10356
- "@typescript-eslint/no-loss-of-precision": "error",
10357
- "no-redeclare": "off",
10358
- "@typescript-eslint/no-redeclare": "error",
10359
- "no-restricted-imports": "off",
10360
- "@typescript-eslint/no-restricted-imports": [
10628
+ "no-unused-vars": "off",
10629
+ "@typescript-eslint/no-unused-vars": [
10630
+ "warn",
10631
+ {
10632
+ vars: "all",
10633
+ args: "none",
10634
+ argsIgnorePattern: "^_",
10635
+ varsIgnorePattern: "^_",
10636
+ caughtErrorsIgnorePattern: "^_"
10637
+ }
10638
+ ],
10639
+ "no-use-before-define": "off",
10640
+ "@typescript-eslint/no-use-before-define": [
10361
10641
  "error",
10362
10642
  {
10363
- paths: [
10364
- "error",
10365
- "domain",
10366
- "freelist",
10367
- "smalloc",
10368
- "punycode",
10369
- "sys",
10370
- "querystring",
10371
- "colors"
10372
- ]
10643
+ functions: true,
10644
+ classes: true,
10645
+ variables: true,
10646
+ enums: true,
10647
+ typedefs: true
10373
10648
  }
10374
10649
  ],
10375
- "padding-line-between-statements": "off",
10376
- "@typescript-eslint/padding-line-between-statements": "off",
10377
- quotes: "off",
10378
- "@typescript-eslint/quotes": "off",
10379
- "space-before-function-paren": "off",
10380
- "@typescript-eslint/space-before-function-paren": "off",
10381
- "space-infix-ops": "off",
10382
- "@typescript-eslint/space-infix-ops": "error",
10383
- semi: "off",
10384
- "@typescript-eslint/semi": ["error", "always"],
10385
- "space-before-blocks": "off",
10386
- "@typescript-eslint/space-before-blocks": ["error", "always"],
10387
- "no-undef": "off",
10388
- "no-duplicate-imports": "off"
10389
- };
10390
- }
10391
- function typescriptRules(props) {
10392
- const { typeAware } = props ?? {};
10393
- if (typeAware === true) {
10394
- return {
10395
- ...typescriptRulesTypeOblivious(),
10396
- ...typescriptRulesTypeAware()
10397
- };
10398
- }
10399
- return typescriptRulesTypeOblivious();
10400
- }
10401
-
10402
- // src/configs/markdown.ts
10403
- var markdown = async (options) => {
10404
- const { componentExts = [], overrides = {} } = options ?? {};
10405
- const { pluginMarkdown } = await importPluginMarkdown();
10406
- const tsRulesOff = Object.fromEntries(
10407
- // @ts-expect-error - undefined
10408
- Object.keys(typescriptRulesTypeAware()).map((key) => [
10409
- `@typescript-eslint/${key}`,
10410
- "off"
10411
- ])
10412
- );
10413
- return [
10414
- {
10415
- name: "jsse:markdown:setup",
10416
- plugins: {
10417
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
10418
- markdown: pluginMarkdown
10650
+ "@typescript-eslint/prefer-namespace-keyword": "warn",
10651
+ "@typescript-eslint/typedef": [
10652
+ "warn",
10653
+ {
10654
+ arrayDestructuring: false,
10655
+ arrowParameter: false,
10656
+ memberVariableDeclaration: true,
10657
+ objectDestructuring: false,
10658
+ parameter: true,
10659
+ propertyDeclaration: true,
10660
+ variableDeclaration: false,
10661
+ variableDeclarationIgnoreFunction: true
10419
10662
  }
10420
- },
10421
- {
10422
- files: [GLOB_MARKDOWN],
10423
- name: "jsse:markdown:processor",
10424
- processor: "markdown/markdown"
10425
- },
10426
- {
10427
- files: [
10428
- GLOB_MARKDOWN_CODE,
10429
- ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
10430
- ],
10431
- languageOptions: {
10432
- parserOptions: {
10433
- ecmaFeatures: {
10434
- impliedStrict: true
10435
- }
10436
- }
10437
- },
10438
- name: "jsse:markdown:rules",
10439
- rules: {
10440
- "@typescript-eslint/consistent-type-imports": "off",
10441
- "@typescript-eslint/no-namespace": "off",
10442
- "@typescript-eslint/no-redeclare": "off",
10443
- "@typescript-eslint/no-require-imports": "off",
10444
- "@typescript-eslint/no-unused-vars": "off",
10445
- "@typescript-eslint/no-use-before-define": "off",
10446
- "@typescript-eslint/no-var-requires": "off",
10447
- "no-alert": "off",
10448
- "no-console": "off",
10449
- "no-undef": "off",
10450
- "no-unused-expressions": "off",
10451
- "no-unused-vars": "off",
10452
- "node/prefer-global/process": "off",
10453
- // Type aware rules
10454
- "object-curly-newline": "off",
10455
- "style/comma-dangle": "off",
10456
- "style/eol-last": "off",
10457
- "unicode-bom": "off",
10458
- "unused-imports/no-unused-imports": "off",
10459
- "unused-imports/no-unused-vars": "off",
10460
- ...tsRulesOff,
10461
- ...overrides
10663
+ ],
10664
+ "accessor-pairs": "error",
10665
+ "for-direction": "warn",
10666
+ "guard-for-in": "error",
10667
+ "max-lines": [
10668
+ "warn",
10669
+ {
10670
+ max: 2e3
10462
10671
  }
10463
- }
10464
- ];
10465
- };
10466
-
10467
- // src/configs/comments.ts
10468
- var comments = async () => [
10469
- {
10470
- name: "jsse:eslint-comments",
10471
- plugins: {
10472
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
10473
- "eslint-comments": import_eslint_plugin_eslint_comments.default
10474
- },
10475
- rules: {
10476
- "eslint-comments/no-aggregating-enable": "error",
10477
- "eslint-comments/no-duplicate-disable": "error",
10478
- "eslint-comments/no-unlimited-disable": "error",
10479
- "eslint-comments/no-unused-enable": "error"
10480
- }
10481
- }
10482
- ];
10483
-
10484
- // src/configs/ignores.ts
10485
- var ignores = async () => {
10486
- return [
10487
- {
10488
- ignores: GLOB_EXCLUDE
10489
- }
10490
- ];
10491
- };
10492
-
10493
- // src/configs/imports.ts
10494
- var imports = async (options) => {
10495
- const { stylistic: stylistic2 = true } = options ?? {};
10496
- return [
10497
- {
10498
- name: "jsse:import",
10499
- plugins: {
10500
- import: pluginImport
10501
- },
10502
- rules: {
10503
- "import/first": "error",
10504
- "import/no-duplicates": "error",
10505
- "import/no-mutable-exports": "error",
10506
- "import/no-named-default": "error",
10507
- "import/no-self-import": "error",
10508
- "import/no-webpack-loader-syntax": "error",
10509
- "import/order": "error",
10510
- ...stylistic2 ? {
10511
- "import/newline-after-import": [
10512
- "error",
10513
- { considerComments: true, count: 1 }
10514
- ]
10515
- } : {}
10672
+ ],
10673
+ "no-async-promise-executor": "error",
10674
+ "no-bitwise": [
10675
+ "warn",
10676
+ {
10677
+ allow: ["^", "<<", ">>", ">>>", "^=", "<<=", ">>=", ">>>=", "~"]
10516
10678
  }
10517
- }
10518
- ];
10519
- };
10520
-
10521
- // src/configs/javascript.ts
10522
- var import_js = __toESM(require("@eslint/js"), 1);
10523
- var import_globals = __toESM(require_globals2(), 1);
10524
- var javascript = async (options) => {
10525
- const {
10526
- isInEditor: isInEditor2 = false,
10527
- overrides = {},
10528
- reportUnusedDisableDirectives = true
10529
- } = options ?? {};
10530
- return [
10531
- {
10532
- languageOptions: {
10533
- ecmaVersion: 2022,
10534
- globals: {
10535
- ...import_globals.default.browser,
10536
- ...import_globals.default.es2021,
10537
- ...import_globals.default.node,
10538
- document: "readonly",
10539
- navigator: "readonly",
10540
- window: "readonly"
10541
- },
10542
- parserOptions: {
10543
- ecmaFeatures: {
10544
- jsx: true
10545
- },
10546
- ecmaVersion: 2022,
10547
- sourceType: "module"
10548
- },
10549
- sourceType: "module"
10550
- },
10551
- linterOptions: {
10552
- reportUnusedDisableDirectives
10553
- },
10554
- name: "jsse:javascript",
10555
- plugins: {
10556
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
10557
- "unused-imports": import_eslint_plugin_unused_imports.default
10558
- },
10559
- rules: {
10560
- ...import_js.default.configs.recommended.rules,
10561
- "accessor-pairs": [
10562
- "error",
10563
- { enforceForClassMembers: true, setWithoutGet: true }
10564
- ],
10565
- "array-callback-return": "error",
10566
- "arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
10567
- "block-scoped-var": "error",
10568
- "constructor-super": "error",
10569
- "default-case-last": "error",
10570
- "dot-notation": ["error", { allowKeywords: true }],
10571
- eqeqeq: ["error", "smart"],
10572
- "new-cap": [
10573
- "error",
10574
- { capIsNew: false, newIsCap: true, properties: true }
10575
- ],
10576
- "no-alert": "error",
10577
- "no-array-constructor": "error",
10578
- "no-async-promise-executor": "error",
10579
- "no-caller": "error",
10580
- "no-case-declarations": "error",
10581
- "no-class-assign": "error",
10582
- "no-compare-neg-zero": "error",
10583
- "no-cond-assign": ["error", "always"],
10584
- "no-console": ["error", { allow: ["warn", "error"] }],
10585
- "no-const-assign": "error",
10586
- "no-control-regex": "error",
10587
- "no-debugger": "error",
10588
- "no-delete-var": "error",
10589
- "no-dupe-args": "error",
10590
- "no-dupe-class-members": "error",
10591
- "no-dupe-keys": "error",
10592
- "no-duplicate-case": "error",
10593
- "no-empty": ["error", { allowEmptyCatch: true }],
10594
- "no-empty-character-class": "error",
10595
- "no-empty-pattern": "error",
10596
- "no-eval": "error",
10597
- "no-ex-assign": "error",
10598
- "no-extend-native": "error",
10599
- "no-extra-bind": "error",
10600
- "no-extra-boolean-cast": "error",
10601
- "no-fallthrough": "error",
10602
- "no-func-assign": "error",
10603
- "no-global-assign": "error",
10604
- "no-implied-eval": "error",
10605
- "no-import-assign": "error",
10606
- "no-invalid-regexp": "error",
10607
- "no-invalid-this": "error",
10608
- "no-irregular-whitespace": "error",
10609
- "no-iterator": "error",
10610
- "no-labels": ["error", { allowLoop: false, allowSwitch: false }],
10611
- "no-lone-blocks": "error",
10612
- "no-loss-of-precision": "error",
10613
- "no-misleading-character-class": "error",
10614
- "no-multi-str": "error",
10615
- "no-nested-ternary": "off",
10616
- "no-new": "error",
10617
- "no-new-func": "error",
10618
- "no-new-object": "error",
10619
- "no-new-symbol": "error",
10620
- "no-new-wrappers": "error",
10621
- "no-obj-calls": "error",
10622
- "no-octal": "error",
10623
- "no-octal-escape": "error",
10624
- "no-proto": "error",
10625
- "no-prototype-builtins": "error",
10626
- "no-redeclare": ["error", { builtinGlobals: false }],
10627
- "no-regex-spaces": "error",
10628
- "no-restricted-globals": [
10629
- "error",
10630
- { message: "Use `globalThis` instead.", name: "global" },
10631
- { message: "Use `globalThis` instead.", name: "self" }
10632
- ],
10633
- "no-restricted-properties": [
10634
- "error",
10635
- {
10636
- message: "Use `Object.getPrototypeOf` or `Object.setPrototypeOf` instead.",
10637
- property: "__proto__"
10638
- },
10639
- {
10640
- message: "Use `Object.defineProperty` instead.",
10641
- property: "__defineGetter__"
10642
- },
10643
- {
10644
- message: "Use `Object.defineProperty` instead.",
10645
- property: "__defineSetter__"
10646
- },
10647
- {
10648
- message: "Use `Object.getOwnPropertyDescriptor` instead.",
10649
- property: "__lookupGetter__"
10650
- },
10651
- {
10652
- message: "Use `Object.getOwnPropertyDescriptor` instead.",
10653
- property: "__lookupSetter__"
10654
- }
10655
- ],
10656
- "no-restricted-syntax": [
10657
- "error",
10658
- "DebuggerStatement",
10659
- "LabeledStatement",
10660
- "WithStatement",
10661
- "TSEnumDeclaration[const=true]",
10662
- "TSExportAssignment"
10663
- ],
10664
- "no-self-assign": ["error", { props: true }],
10665
- "no-self-compare": "error",
10666
- "no-sequences": "error",
10667
- "no-shadow-restricted-names": "error",
10668
- "no-sparse-arrays": "error",
10669
- "no-template-curly-in-string": "error",
10670
- "no-this-before-super": "error",
10671
- "no-throw-literal": "error",
10672
- "no-undef": "error",
10673
- "no-undef-init": "error",
10674
- "no-unexpected-multiline": "error",
10675
- "no-unmodified-loop-condition": "error",
10676
- "no-unneeded-ternary": ["error", { defaultAssignment: false }],
10677
- "no-unreachable": "error",
10678
- "no-unreachable-loop": "error",
10679
- "no-unsafe-finally": "error",
10680
- "no-unsafe-negation": "error",
10681
- "no-unused-expressions": [
10682
- "error",
10683
- {
10684
- allowShortCircuit: true,
10685
- allowTaggedTemplates: true,
10686
- allowTernary: true
10687
- }
10688
- ],
10689
- "no-unused-vars": [
10690
- "error",
10691
- {
10692
- args: "none",
10693
- caughtErrors: "none",
10694
- ignoreRestSiblings: true,
10695
- vars: "all"
10696
- }
10697
- ],
10698
- "no-use-before-define": [
10699
- "error",
10700
- { classes: false, functions: false, variables: true }
10701
- ],
10702
- "no-useless-backreference": "error",
10703
- "no-useless-call": "error",
10704
- "no-useless-catch": "error",
10705
- "no-useless-computed-key": "error",
10706
- "no-useless-constructor": "error",
10707
- "no-useless-rename": "error",
10708
- "no-useless-return": "error",
10709
- "no-var": "error",
10710
- "no-with": "error",
10711
- "object-shorthand": [
10712
- "error",
10713
- "always",
10714
- {
10715
- avoidQuotes: true,
10716
- ignoreConstructors: false
10717
- }
10718
- ],
10719
- "one-var": ["error", { initialized: "never" }],
10720
- "prefer-arrow-callback": [
10721
- "error",
10722
- {
10723
- allowNamedFunctions: false,
10724
- allowUnboundThis: true
10725
- }
10726
- ],
10727
- "prefer-const": [
10728
- "error",
10729
- {
10730
- destructuring: "all",
10731
- ignoreReadBeforeAssign: true
10732
- }
10733
- ],
10734
- "prefer-exponentiation-operator": "error",
10735
- "prefer-promise-reject-errors": "error",
10736
- "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
10737
- "prefer-rest-params": "error",
10738
- "prefer-spread": "error",
10739
- "prefer-template": "error",
10740
- "sort-imports": [
10741
- "error",
10742
- {
10743
- allowSeparatedGroups: false,
10744
- ignoreCase: false,
10745
- ignoreDeclarationSort: true,
10746
- ignoreMemberSort: false,
10747
- memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
10748
- }
10749
- ],
10750
- "symbol-description": "error",
10751
- "unicode-bom": ["error", "never"],
10752
- "unused-imports/no-unused-imports": isInEditor2 ? "off" : "error",
10753
- "unused-imports/no-unused-vars": [
10754
- "error",
10755
- {
10756
- args: "after-used",
10757
- argsIgnorePattern: "^_",
10758
- vars: "all",
10759
- varsIgnorePattern: "^_"
10760
- }
10761
- ],
10762
- "use-isnan": [
10763
- "error",
10764
- { enforceForIndexOf: true, enforceForSwitchCase: true }
10765
- ],
10766
- "valid-typeof": ["error", { requireStringLiterals: true }],
10767
- "vars-on-top": "error",
10768
- yoda: ["error", "never"],
10769
- ...overrides
10679
+ ],
10680
+ "no-caller": "error",
10681
+ "no-compare-neg-zero": "error",
10682
+ "no-cond-assign": "error",
10683
+ "no-constant-condition": "warn",
10684
+ "no-control-regex": "error",
10685
+ "no-debugger": "warn",
10686
+ "no-delete-var": "error",
10687
+ "no-duplicate-case": "error",
10688
+ "no-empty": "warn",
10689
+ "no-empty-character-class": "error",
10690
+ "no-empty-pattern": "warn",
10691
+ "no-eval": "warn",
10692
+ "no-ex-assign": "error",
10693
+ "no-extend-native": "error",
10694
+ "no-extra-boolean-cast": "warn",
10695
+ "no-extra-label": "warn",
10696
+ "no-fallthrough": "error",
10697
+ "no-func-assign": "warn",
10698
+ "no-implied-eval": "error",
10699
+ "no-invalid-regexp": "error",
10700
+ "no-label-var": "error",
10701
+ "no-lone-blocks": "warn",
10702
+ "no-misleading-character-class": "error",
10703
+ "no-multi-str": "error",
10704
+ "no-new": "warn",
10705
+ "no-new-func": "error",
10706
+ "no-new-wrappers": "warn",
10707
+ "no-octal": "error",
10708
+ "no-octal-escape": "error",
10709
+ "no-regex-spaces": "error",
10710
+ "no-return-assign": "error",
10711
+ "no-script-url": "warn",
10712
+ "no-self-assign": "error",
10713
+ "no-self-compare": "error",
10714
+ "no-sequences": "error",
10715
+ "no-shadow-restricted-names": "error",
10716
+ "no-sparse-arrays": "error",
10717
+ "no-unmodified-loop-condition": "warn",
10718
+ "no-unsafe-finally": "error",
10719
+ "no-unused-expressions": "off",
10720
+ "@typescript-eslint/no-unused-expressions": "error",
10721
+ "no-unused-labels": "error",
10722
+ "no-useless-catch": "warn",
10723
+ "no-useless-concat": "error",
10724
+ "no-var": "error",
10725
+ "no-void": [
10726
+ "error",
10727
+ {
10728
+ allowAsStatement: true
10770
10729
  }
10771
- },
10772
- {
10773
- files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
10774
- name: "jsse:scripts-overrides",
10775
- rules: {
10776
- "no-console": "off"
10730
+ ],
10731
+ "no-with": "error",
10732
+ "prefer-const": "error",
10733
+ "require-atomic-updates": "error",
10734
+ "require-yield": "warn",
10735
+ strict: ["error", "never"],
10736
+ "use-isnan": "error",
10737
+ "no-useless-constructor": "off",
10738
+ "@typescript-eslint/no-useless-constructor": "error",
10739
+ "@typescript-eslint/no-unnecessary-type-constraint": "error",
10740
+ "@typescript-eslint/brace-style": [
10741
+ "error",
10742
+ "1tbs",
10743
+ {
10744
+ allowSingleLine: false
10777
10745
  }
10778
- }
10779
- ];
10780
- };
10781
-
10782
- // src/configs/jsdoc.ts
10783
- var jsdoc = async () => {
10784
- const { pluginJsdoc } = await importPluginJsdoc();
10785
- return [
10786
- {
10787
- name: "jsse:jsdoc",
10788
- plugins: {
10789
- jsdoc: pluginJsdoc
10790
- },
10791
- rules: {
10792
- "jsdoc/check-access": "warn",
10793
- "jsdoc/check-alignment": "warn",
10794
- "jsdoc/check-param-names": "warn",
10795
- "jsdoc/check-property-names": "warn",
10796
- "jsdoc/check-types": "warn",
10797
- "jsdoc/empty-tags": "warn",
10798
- "jsdoc/implements-on-classes": "warn",
10799
- "jsdoc/multiline-blocks": "warn",
10800
- "jsdoc/no-defaults": "warn",
10801
- "jsdoc/no-multi-asterisks": "warn",
10802
- "jsdoc/require-param-name": "warn",
10803
- "jsdoc/require-property": "warn",
10804
- "jsdoc/require-property-description": "warn",
10805
- "jsdoc/require-property-name": "warn",
10806
- "jsdoc/require-returns-check": "warn",
10807
- "jsdoc/require-returns-description": "warn",
10808
- "jsdoc/require-yields-check": "warn"
10746
+ ],
10747
+ "comma-spacing": "off",
10748
+ "@typescript-eslint/comma-spacing": [
10749
+ "error",
10750
+ {
10751
+ before: false,
10752
+ after: true
10809
10753
  }
10810
- }
10811
- ];
10812
- };
10754
+ ],
10755
+ "default-param-last": "off",
10756
+ "@typescript-eslint/default-param-last": "error",
10757
+ "func-call-spacing": "off",
10758
+ "@typescript-eslint/func-call-spacing": ["error", "never"],
10759
+ "keyword-spacing": "off",
10760
+ "@typescript-eslint/keyword-spacing": "error",
10761
+ "lines-between-class-members": "off",
10762
+ "@typescript-eslint/lines-between-class-members": [
10763
+ "error",
10764
+ "always",
10765
+ {
10766
+ exceptAfterSingleLine: true
10767
+ }
10768
+ ],
10769
+ "no-dupe-class-members": "off",
10770
+ "@typescript-eslint/no-dupe-class-members": "error",
10771
+ "no-empty-function": "off",
10772
+ "@typescript-eslint/no-empty-function": "error",
10773
+ "no-extra-parens": "off",
10774
+ "no-extra-semi": "off",
10775
+ "@typescript-eslint/no-extra-semi": "error",
10776
+ "no-loop-func": "off",
10777
+ "@typescript-eslint/no-loop-func": "error",
10778
+ "no-loss-of-precision": "off",
10779
+ "@typescript-eslint/no-loss-of-precision": "error",
10780
+ "no-redeclare": "off",
10781
+ "@typescript-eslint/no-redeclare": "error",
10782
+ "no-restricted-imports": "off",
10783
+ "@typescript-eslint/no-restricted-imports": [
10784
+ "error",
10785
+ {
10786
+ paths: [
10787
+ "error",
10788
+ "domain",
10789
+ "freelist",
10790
+ "smalloc",
10791
+ "punycode",
10792
+ "sys",
10793
+ "querystring",
10794
+ "colors"
10795
+ ]
10796
+ }
10797
+ ],
10798
+ "padding-line-between-statements": "off",
10799
+ "@typescript-eslint/padding-line-between-statements": "off",
10800
+ quotes: "off",
10801
+ "@typescript-eslint/quotes": "off",
10802
+ "space-before-function-paren": "off",
10803
+ "@typescript-eslint/space-before-function-paren": "off",
10804
+ "space-infix-ops": "off",
10805
+ "@typescript-eslint/space-infix-ops": "error",
10806
+ semi: "off",
10807
+ "@typescript-eslint/semi": ["error", "always"],
10808
+ "space-before-blocks": "off",
10809
+ "@typescript-eslint/space-before-blocks": ["error", "always"],
10810
+ "no-undef": "off",
10811
+ "no-duplicate-imports": "off"
10812
+ };
10813
+ }
10814
+ function typescriptRules(props) {
10815
+ const { typeAware } = props ?? {};
10816
+ if (typeAware === true) {
10817
+ return {
10818
+ ...typescriptRulesTypeOblivious(),
10819
+ ...typescriptRulesTypeAware()
10820
+ };
10821
+ }
10822
+ return typescriptRulesTypeOblivious();
10823
+ }
10813
10824
 
10814
- // src/configs/jsonc.ts
10815
- var jsonc = async (options) => {
10816
- const { overrides = {}, stylistic: stylistic2 = true } = options ?? {};
10817
- const { indent = 2 } = typeof stylistic2 === "boolean" ? {} : stylistic2;
10818
- const { parserJsonc, pluginJsonc } = await importJsoncLibs();
10825
+ // src/configs/markdown.ts
10826
+ var markdown = async (options) => {
10827
+ const { componentExts = [], overrides = {} } = options ?? {};
10828
+ const { pluginMarkdown } = await importPluginMarkdown();
10829
+ const tsRulesOff = Object.fromEntries(
10830
+ // @ts-expect-error - undefined
10831
+ Object.keys(typescriptRulesTypeAware()).map((key) => [
10832
+ `@typescript-eslint/${key}`,
10833
+ "off"
10834
+ ])
10835
+ );
10819
10836
  return [
10820
10837
  {
10821
- name: "jsse:jsonc:setup",
10822
- plugins: {
10823
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any
10824
- jsonc: pluginJsonc
10825
- }
10826
- },
10827
- {
10828
- files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
10829
- languageOptions: {
10830
- parser: parserJsonc
10831
- },
10832
- name: "jsse:jsonc:rules",
10833
- rules: {
10834
- "jsonc/no-bigint-literals": "error",
10835
- "jsonc/no-binary-expression": "error",
10836
- "jsonc/no-binary-numeric-literals": "error",
10837
- "jsonc/no-dupe-keys": "error",
10838
- "jsonc/no-escape-sequence-in-identifier": "error",
10839
- "jsonc/no-floating-decimal": "error",
10840
- "jsonc/no-hexadecimal-numeric-literals": "error",
10841
- "jsonc/no-infinity": "error",
10842
- "jsonc/no-multi-str": "error",
10843
- "jsonc/no-nan": "error",
10844
- "jsonc/no-number-props": "error",
10845
- "jsonc/no-numeric-separators": "error",
10846
- "jsonc/no-octal": "error",
10847
- "jsonc/no-octal-escape": "error",
10848
- "jsonc/no-octal-numeric-literals": "error",
10849
- "jsonc/no-parenthesized": "error",
10850
- "jsonc/no-plus-sign": "error",
10851
- "jsonc/no-regexp-literals": "error",
10852
- "jsonc/no-sparse-arrays": "error",
10853
- "jsonc/no-template-literals": "error",
10854
- "jsonc/no-undefined-value": "error",
10855
- "jsonc/no-unicode-codepoint-escapes": "error",
10856
- "jsonc/no-useless-escape": "error",
10857
- "jsonc/space-unary-ops": "error",
10858
- "jsonc/valid-json-number": "error",
10859
- "jsonc/vue-custom-block/no-parsing-error": "error",
10860
- ...stylistic2 ? {
10861
- "jsonc/array-bracket-spacing": ["error", "never"],
10862
- "jsonc/comma-dangle": ["error", "never"],
10863
- "jsonc/comma-style": ["error", "last"],
10864
- "jsonc/indent": ["error", indent],
10865
- "jsonc/key-spacing": [
10866
- "error",
10867
- { afterColon: true, beforeColon: false }
10868
- ],
10869
- "jsonc/object-curly-newline": [
10870
- "error",
10871
- { consistent: true, multiline: true }
10872
- ],
10873
- "jsonc/object-curly-spacing": ["error", "always"],
10874
- "jsonc/object-property-newline": [
10875
- "error",
10876
- { allowMultiplePropertiesPerLine: true }
10877
- ],
10878
- "jsonc/quote-props": "error",
10879
- "jsonc/quotes": "error"
10880
- } : {},
10838
+ name: "jsse:markdown:setup",
10839
+ plugins: {
10840
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
10841
+ markdown: pluginMarkdown
10842
+ }
10843
+ },
10844
+ {
10845
+ files: [GLOB_MARKDOWN],
10846
+ name: "jsse:markdown:processor",
10847
+ processor: "markdown/markdown"
10848
+ },
10849
+ {
10850
+ files: [
10851
+ GLOB_MARKDOWN_CODE,
10852
+ ...componentExts.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
10853
+ ],
10854
+ languageOptions: {
10855
+ parserOptions: {
10856
+ ecmaFeatures: {
10857
+ impliedStrict: true
10858
+ }
10859
+ }
10860
+ },
10861
+ name: "jsse:markdown:rules",
10862
+ rules: {
10863
+ "@typescript-eslint/consistent-type-imports": "off",
10864
+ "@typescript-eslint/no-namespace": "off",
10865
+ "@typescript-eslint/no-redeclare": "off",
10866
+ "@typescript-eslint/no-require-imports": "off",
10867
+ "@typescript-eslint/no-unused-vars": "off",
10868
+ "@typescript-eslint/no-use-before-define": "off",
10869
+ "@typescript-eslint/no-var-requires": "off",
10870
+ "no-alert": "off",
10871
+ "no-console": "off",
10872
+ "no-undef": "off",
10873
+ "no-unused-expressions": "off",
10874
+ "no-unused-vars": "off",
10875
+ "node/prefer-global/process": "off",
10876
+ // Type aware rules
10877
+ "object-curly-newline": "off",
10878
+ "style/comma-dangle": "off",
10879
+ "style/eol-last": "off",
10880
+ "unicode-bom": "off",
10881
+ "unused-imports/no-unused-imports": "off",
10882
+ "unused-imports/no-unused-vars": "off",
10883
+ ...tsRulesOff,
10881
10884
  ...overrides
10882
10885
  }
10883
10886
  }
@@ -11337,91 +11340,7 @@ var react = async (options) => {
11337
11340
  return config;
11338
11341
  };
11339
11342
 
11340
- // src/configs/stylistic.ts
11341
- function jsxStylistic({
11342
- indent
11343
- }) {
11344
- return {
11345
- "@stylistic/jsx-curly-brace-presence": [
11346
- "error",
11347
- { propElementValues: "always" }
11348
- ],
11349
- "@stylistic/jsx-indent": [
11350
- "error",
11351
- indent,
11352
- { checkAttributes: true, indentLogicalExpressions: true }
11353
- ],
11354
- "@stylistic/jsx-quotes": "error"
11355
- };
11356
- }
11357
- var stylistic = async (options) => {
11358
- const { indent = 2, jsx = true, quotes = "double" } = options ?? {};
11359
- const { pluginStylistic } = await importPluginStylistic();
11360
- return [
11361
- {
11362
- name: "jsse:stylistic",
11363
- plugins: {
11364
- // eslint-disable-next-line @typescript-eslint/naming-convention
11365
- "@stylistic": pluginStylistic
11366
- },
11367
- rules: {
11368
- "@stylistic/quote-props": ["error", "as-needed"],
11369
- "@stylistic/quotes": [
11370
- "error",
11371
- quotes,
11372
- { allowTemplateLiterals: false, avoidEscape: true }
11373
- ],
11374
- ...jsx ? jsxStylistic({ indent }) : {}
11375
- }
11376
- }
11377
- ];
11378
- };
11379
-
11380
- // src/configs/tailwind.ts
11381
- var TAILWIND_ESLINT_SETTINGS_DEFAULT = {
11382
- // These are the default values but feel free to customize
11383
- callees: ["classnames", "clsx", "ctl", "cn", "cx", "twMerge", "twJoin"],
11384
- classRegex: "^class(Name)?$",
11385
- // can be modified to support custom attributes. E.g. "^tw$" for `twin.macro`
11386
- config: "tailwind.config.js",
11387
- // returned from `loadConfig()` utility if not provided
11388
- cssFiles: ["**/*.css", "!**/node_modules", "!**/.*", "!**/dist", "!**/build"],
11389
- cssFilesRefreshRate: 5e3,
11390
- removeDuplicates: true,
11391
- skipClassAttribute: false,
11392
- tags: [],
11393
- // can be set to e.g. ['tw'] for use in tw`bg-blue`
11394
- whitelist: []
11395
- };
11396
- function tailwindSettings(options) {
11397
- if (typeof options === "boolean") {
11398
- return TAILWIND_ESLINT_SETTINGS_DEFAULT;
11399
- }
11400
- return { ...TAILWIND_ESLINT_SETTINGS_DEFAULT, ...options };
11401
- }
11402
- var tailwind = async (options) => {
11403
- const { pluginTailwind } = await importPluginTailwind();
11404
- return [
11405
- {
11406
- files: [GLOB_SRC],
11407
- name: "jsse:tailwind:rules",
11408
- plugins: {
11409
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
11410
- tailwindcss: pluginTailwind
11411
- },
11412
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
11413
- rules: {
11414
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
11415
- ...pluginTailwind.configs.recommended.rules
11416
- },
11417
- settings: {
11418
- tailwindcss: tailwindSettings(options)
11419
- }
11420
- }
11421
- ];
11422
- };
11423
-
11424
- // src/configs/sort.ts
11343
+ // src/configs/sort-package-json.ts
11425
11344
  var sortPackageJson = async () => {
11426
11345
  return [
11427
11346
  {
@@ -11506,6 +11425,8 @@ var sortPackageJson = async () => {
11506
11425
  }
11507
11426
  ];
11508
11427
  };
11428
+
11429
+ // src/configs/sort-tsconfig.ts
11509
11430
  var sortTsconfig = async () => {
11510
11431
  return [
11511
11432
  {
@@ -11632,36 +11553,111 @@ var sortTsconfig = async () => {
11632
11553
  ];
11633
11554
  };
11634
11555
 
11556
+ // src/configs/stylistic.ts
11557
+ function jsxStylistic({
11558
+ indent
11559
+ }) {
11560
+ return {
11561
+ "@stylistic/jsx-curly-brace-presence": [
11562
+ "error",
11563
+ { propElementValues: "always" }
11564
+ ],
11565
+ "@stylistic/jsx-indent": [
11566
+ "error",
11567
+ indent,
11568
+ { checkAttributes: true, indentLogicalExpressions: true }
11569
+ ],
11570
+ "@stylistic/jsx-quotes": "error"
11571
+ };
11572
+ }
11573
+ var stylistic = async (options) => {
11574
+ const { indent = 2, jsx = true, quotes = "double" } = options ?? {};
11575
+ const { pluginStylistic } = await importPluginStylistic();
11576
+ return [
11577
+ {
11578
+ name: "jsse:stylistic",
11579
+ plugins: {
11580
+ // eslint-disable-next-line @typescript-eslint/naming-convention
11581
+ "@stylistic": pluginStylistic
11582
+ },
11583
+ rules: {
11584
+ "@stylistic/quote-props": ["error", "as-needed"],
11585
+ "@stylistic/quotes": [
11586
+ "error",
11587
+ quotes,
11588
+ { allowTemplateLiterals: false, avoidEscape: true }
11589
+ ],
11590
+ ...jsx ? jsxStylistic({ indent }) : {}
11591
+ }
11592
+ }
11593
+ ];
11594
+ };
11595
+
11596
+ // src/configs/tailwind.ts
11597
+ var TAILWIND_ESLINT_SETTINGS_DEFAULT = {
11598
+ // These are the default values but feel free to customize
11599
+ callees: ["classnames", "clsx", "ctl", "cn", "cx", "twMerge", "twJoin"],
11600
+ classRegex: "^class(Name)?$",
11601
+ // can be modified to support custom attributes. E.g. "^tw$" for `twin.macro`
11602
+ config: "tailwind.config.js",
11603
+ // returned from `loadConfig()` utility if not provided
11604
+ cssFiles: ["**/*.css", "!**/node_modules", "!**/.*", "!**/dist", "!**/build"],
11605
+ cssFilesRefreshRate: 5e3,
11606
+ removeDuplicates: true,
11607
+ skipClassAttribute: false,
11608
+ tags: [],
11609
+ // can be set to e.g. ['tw'] for use in tw`bg-blue`
11610
+ whitelist: []
11611
+ };
11612
+ function tailwindSettings(options) {
11613
+ if (typeof options === "boolean") {
11614
+ return TAILWIND_ESLINT_SETTINGS_DEFAULT;
11615
+ }
11616
+ return { ...TAILWIND_ESLINT_SETTINGS_DEFAULT, ...options };
11617
+ }
11618
+ var tailwind = async (options) => {
11619
+ const { pluginTailwind } = await importPluginTailwind();
11620
+ return [
11621
+ {
11622
+ files: [GLOB_SRC],
11623
+ name: "jsse:tailwind:rules",
11624
+ plugins: {
11625
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
11626
+ tailwindcss: pluginTailwind
11627
+ },
11628
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
11629
+ rules: {
11630
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
11631
+ ...pluginTailwind.configs.recommended.rules
11632
+ },
11633
+ settings: {
11634
+ tailwindcss: tailwindSettings(options)
11635
+ }
11636
+ }
11637
+ ];
11638
+ };
11639
+
11635
11640
  // src/configs/test.ts
11636
- var test = async (options = {}) => {
11641
+ var noOnlyTests = async (options = {}) => {
11637
11642
  const { isInEditor: isInEditor2 = false, overrides = {} } = options;
11638
- const [pluginNoOnlyTests, pluginVitest] = await Promise.all([
11643
+ const pluginNoOnlyTests = await interopDefault2(
11639
11644
  // @ts-expect-error - types are incorrect/missing
11640
- interopDefault2(import("eslint-plugin-no-only-tests")),
11641
- interopDefault2(import("eslint-plugin-vitest"))
11642
- ]);
11645
+ import("eslint-plugin-no-only-tests")
11646
+ );
11643
11647
  return [
11644
11648
  {
11645
- name: "jsse:test:setup",
11649
+ name: "jsse:no-only-tests:setup",
11646
11650
  plugins: {
11647
11651
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
11648
- "no-only-tests": pluginNoOnlyTests,
11649
- vitest: pluginVitest
11652
+ "no-only-tests": pluginNoOnlyTests
11650
11653
  }
11651
11654
  },
11652
11655
  {
11653
11656
  files: GLOB_TESTS,
11654
- name: "jsse:test:rules",
11657
+ name: "jsse:no-only-tests:rules",
11655
11658
  rules: {
11656
11659
  "no-only-tests/no-only-tests": isInEditor2 ? "off" : isCI() ? "error" : "warn",
11657
11660
  "unicorn/no-null": "off",
11658
- "vitest/consistent-test-it": [
11659
- "error",
11660
- { fn: "test", withinDescribe: "test" }
11661
- ],
11662
- "vitest/no-identical-title": "error",
11663
- "vitest/prefer-hooks-in-order": "error",
11664
- "vitest/prefer-lowercase-title": "error",
11665
11661
  ...overrides
11666
11662
  }
11667
11663
  }
@@ -11846,6 +11842,42 @@ var unicorn = async () => {
11846
11842
  // Use new when throwing error
11847
11843
  "unicorn/throw-new-error": "error"
11848
11844
  }
11845
+ },
11846
+ {
11847
+ files: GLOB_TESTS,
11848
+ name: "jsse:unicorn:tests",
11849
+ rules: {
11850
+ "unicorn/no-null": "off",
11851
+ "unicorn/no-unused-properties": "off"
11852
+ }
11853
+ }
11854
+ ];
11855
+ };
11856
+
11857
+ // src/configs/vitest.ts
11858
+ var vitest = async (options = {}) => {
11859
+ const { overrides = {} } = options;
11860
+ const pluginVitest = await interopDefault2(import("eslint-plugin-vitest"));
11861
+ return [
11862
+ {
11863
+ name: "jsse:vitest:setup",
11864
+ plugins: {
11865
+ vitest: pluginVitest
11866
+ }
11867
+ },
11868
+ {
11869
+ files: GLOB_TESTS,
11870
+ name: "jsse:vitest:rules",
11871
+ rules: {
11872
+ "vitest/consistent-test-it": [
11873
+ "error",
11874
+ { fn: "test", withinDescribe: "test" }
11875
+ ],
11876
+ "vitest/no-identical-title": "error",
11877
+ "vitest/prefer-hooks-in-order": "error",
11878
+ "vitest/prefer-lowercase-title": "error",
11879
+ ...overrides
11880
+ }
11849
11881
  }
11850
11882
  ];
11851
11883
  };
@@ -11993,7 +12025,7 @@ async function jsse(options = {}, ...userConfigs) {
11993
12025
  const configs = [];
11994
12026
  if (enableGitignore) {
11995
12027
  if (typeof enableGitignore === "boolean") {
11996
- if (import_node_fs3.default.existsSync(".gitignore"))
12028
+ if (import_node_fs3.default.existsSync(".gitignore")) {
11997
12029
  configs.push(
11998
12030
  interopDefault2(import("eslint-config-flat-gitignore")).then((r2) => {
11999
12031
  const res = r2();
@@ -12001,6 +12033,7 @@ async function jsse(options = {}, ...userConfigs) {
12001
12033
  return [res];
12002
12034
  })
12003
12035
  );
12036
+ }
12004
12037
  } else {
12005
12038
  configs.push(
12006
12039
  interopDefault2(import("eslint-config-flat-gitignore")).then((r2) => {
@@ -12066,7 +12099,11 @@ async function jsse(options = {}, ...userConfigs) {
12066
12099
  }
12067
12100
  if (normalizedOptions.test) {
12068
12101
  configs.push(
12069
- test({
12102
+ vitest({
12103
+ isInEditor: isInEditor2,
12104
+ overrides: overrides.test
12105
+ }),
12106
+ noOnlyTests({
12070
12107
  isInEditor: isInEditor2,
12071
12108
  overrides: overrides.test
12072
12109
  })
@@ -12190,6 +12227,7 @@ function jsseReact() {
12190
12227
  GLOB_SRC_EXT,
12191
12228
  GLOB_STYLE,
12192
12229
  GLOB_TESTS,
12230
+ GLOB_TOML,
12193
12231
  GLOB_TS,
12194
12232
  GLOB_TSX,
12195
12233
  GLOB_YAML,