@debbl/eslint-config 3.9.0 → 3.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +52 -85
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +51 -85
- package/package.json +10 -9
package/dist/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
GLOB_ALL_SRC: () => GLOB_ALL_SRC,
|
|
34
|
+
GLOB_ASTRO_TS: () => GLOB_ASTRO_TS,
|
|
34
35
|
GLOB_CSS: () => GLOB_CSS,
|
|
35
36
|
GLOB_EXCLUDE: () => GLOB_EXCLUDE,
|
|
36
37
|
GLOB_HTML: () => GLOB_HTML,
|
|
@@ -155,6 +156,7 @@ var GLOB_JSONC = "**/*.jsonc";
|
|
|
155
156
|
var GLOB_MARKDOWN = "**/*.md";
|
|
156
157
|
var GLOB_MDX = "**/*.mdx";
|
|
157
158
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
159
|
+
var GLOB_ASTRO_TS = "**/*.astro/*.ts";
|
|
158
160
|
var GLOB_VUE = "**/*.vue";
|
|
159
161
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
160
162
|
var GLOB_TOML = "**/*.toml";
|
|
@@ -244,10 +246,7 @@ async function imports() {
|
|
|
244
246
|
"import/no-named-default": "error",
|
|
245
247
|
"import/no-self-import": "error",
|
|
246
248
|
"import/no-webpack-loader-syntax": "error",
|
|
247
|
-
"import/newline-after-import": [
|
|
248
|
-
"error",
|
|
249
|
-
{ considerComments: true, count: 1 }
|
|
250
|
-
],
|
|
249
|
+
"import/newline-after-import": ["error", { count: 1 }],
|
|
251
250
|
"import/consistent-type-specifier-style": ["error", "prefer-top-level"]
|
|
252
251
|
}
|
|
253
252
|
}
|
|
@@ -1186,6 +1185,7 @@ var typescript = async (options) => {
|
|
|
1186
1185
|
tsconfigPath,
|
|
1187
1186
|
enableSolid = false
|
|
1188
1187
|
} = options ?? {};
|
|
1188
|
+
const isTypeAware = !!tsconfigPath;
|
|
1189
1189
|
const [pluginTs, parserTs] = await Promise.all([
|
|
1190
1190
|
interopDefault(import("@typescript-eslint/eslint-plugin")),
|
|
1191
1191
|
interopDefault(import("@typescript-eslint/parser"))
|
|
@@ -1224,7 +1224,6 @@ var typescript = async (options) => {
|
|
|
1224
1224
|
"solid/no-unknown-namespaces": "off"
|
|
1225
1225
|
} : {},
|
|
1226
1226
|
"no-dupe-class-members": "off",
|
|
1227
|
-
"no-loss-of-precision": "off",
|
|
1228
1227
|
"no-redeclare": "off",
|
|
1229
1228
|
"no-use-before-define": "off",
|
|
1230
1229
|
"no-useless-constructor": "off",
|
|
@@ -1244,8 +1243,8 @@ var typescript = async (options) => {
|
|
|
1244
1243
|
prefer: "type-imports"
|
|
1245
1244
|
}
|
|
1246
1245
|
],
|
|
1247
|
-
// https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
|
|
1248
1246
|
"@typescript-eslint/method-signature-style": ["error", "property"],
|
|
1247
|
+
// https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
|
|
1249
1248
|
"@typescript-eslint/no-dupe-class-members": "error",
|
|
1250
1249
|
"@typescript-eslint/no-dynamic-delete": "off",
|
|
1251
1250
|
"@typescript-eslint/no-empty-object-type": [
|
|
@@ -1256,10 +1255,17 @@ var typescript = async (options) => {
|
|
|
1256
1255
|
"@typescript-eslint/no-extraneous-class": "off",
|
|
1257
1256
|
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
1258
1257
|
"@typescript-eslint/no-invalid-void-type": "off",
|
|
1259
|
-
"@typescript-eslint/no-loss-of-precision": "error",
|
|
1260
1258
|
"@typescript-eslint/no-non-null-assertion": "off",
|
|
1261
|
-
"@typescript-eslint/no-redeclare": "error",
|
|
1259
|
+
"@typescript-eslint/no-redeclare": ["error", { builtinGlobals: false }],
|
|
1262
1260
|
"@typescript-eslint/no-require-imports": "error",
|
|
1261
|
+
"@typescript-eslint/no-unused-expressions": [
|
|
1262
|
+
"error",
|
|
1263
|
+
{
|
|
1264
|
+
allowShortCircuit: true,
|
|
1265
|
+
allowTaggedTemplates: true,
|
|
1266
|
+
allowTernary: true
|
|
1267
|
+
}
|
|
1268
|
+
],
|
|
1263
1269
|
"@typescript-eslint/no-unused-vars": "off",
|
|
1264
1270
|
"@typescript-eslint/no-use-before-define": [
|
|
1265
1271
|
"error",
|
|
@@ -1269,10 +1275,19 @@ var typescript = async (options) => {
|
|
|
1269
1275
|
"@typescript-eslint/no-wrapper-object-types": "error",
|
|
1270
1276
|
"@typescript-eslint/triple-slash-reference": "off",
|
|
1271
1277
|
"@typescript-eslint/unified-signatures": "off",
|
|
1272
|
-
...tsconfigPath ? typeAwareRules : {},
|
|
1273
1278
|
...overrides
|
|
1274
1279
|
}
|
|
1275
1280
|
},
|
|
1281
|
+
...isTypeAware ? [
|
|
1282
|
+
{
|
|
1283
|
+
name: "eslint/typescript/rules-type-aware",
|
|
1284
|
+
files: [GLOB_TS, GLOB_TSX],
|
|
1285
|
+
ignores: [`${GLOB_MARKDOWN}/**`, `${GLOB_ASTRO_TS}/**`],
|
|
1286
|
+
rules: {
|
|
1287
|
+
...typeAwareRules
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
] : [],
|
|
1276
1291
|
{
|
|
1277
1292
|
name: "eslint/typescript/dts-overrides",
|
|
1278
1293
|
files: ["**/*.d.ts"],
|
|
@@ -1311,6 +1326,9 @@ async function unicorn() {
|
|
|
1311
1326
|
unicorn: pluginUnicorn
|
|
1312
1327
|
},
|
|
1313
1328
|
rules: {
|
|
1329
|
+
"unicorn/consistent-empty-array-spread": "error",
|
|
1330
|
+
"unicorn/escape-case": "error",
|
|
1331
|
+
"unicorn/new-for-builtins": "error",
|
|
1314
1332
|
// Pass error message when throwing errors
|
|
1315
1333
|
"unicorn/error-message": "error",
|
|
1316
1334
|
// Uppercase regex escapes
|
|
@@ -1318,8 +1336,7 @@ async function unicorn() {
|
|
|
1318
1336
|
"error",
|
|
1319
1337
|
{ checkArrowFunctions: false }
|
|
1320
1338
|
],
|
|
1321
|
-
|
|
1322
|
-
"unicorn/no-instanceof-array": "error",
|
|
1339
|
+
"unicorn/no-instanceof-builtins": "error",
|
|
1323
1340
|
// Ban `new Array` as `Array` constructor's params are ambiguous
|
|
1324
1341
|
"unicorn/no-new-array": "error",
|
|
1325
1342
|
// Prevent deprecated `new Buffer()`
|
|
@@ -1581,23 +1598,28 @@ var react = async (options) => {
|
|
|
1581
1598
|
compiler: enableCompiler = false,
|
|
1582
1599
|
overrides = {}
|
|
1583
1600
|
} = options;
|
|
1584
|
-
const [
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1601
|
+
const [pluginsReact, pluginReactHooks, pluginReactRefresh] = await Promise.all([
|
|
1602
|
+
interopDefault(import("@eslint-react/eslint-plugin")),
|
|
1603
|
+
interopDefault(import("eslint-plugin-react-hooks")),
|
|
1604
|
+
interopDefault(import("eslint-plugin-react-refresh"))
|
|
1605
|
+
]);
|
|
1606
|
+
const plugins = pluginsReact.configs.all.plugins;
|
|
1607
|
+
const {
|
|
1608
|
+
"@eslint-react": pluginReactX,
|
|
1609
|
+
"@eslint-react/dom": pluginReactDom,
|
|
1610
|
+
"@eslint-react/hooks-extra": pluginReactHooksExtra,
|
|
1611
|
+
"@eslint-react/naming-convention": pluginReactNamingConvention,
|
|
1612
|
+
"@eslint-react/web-api": pluginReactWebApi
|
|
1613
|
+
} = plugins;
|
|
1592
1614
|
const _react = [
|
|
1593
1615
|
{
|
|
1594
1616
|
name: "eslint/react/setup",
|
|
1595
1617
|
plugins: {
|
|
1596
|
-
"react":
|
|
1597
|
-
"react-dom":
|
|
1598
|
-
"react-hooks-extra":
|
|
1599
|
-
"react-naming-convention":
|
|
1600
|
-
"react-web-api":
|
|
1618
|
+
"react-x": pluginReactX,
|
|
1619
|
+
"react-dom": pluginReactDom,
|
|
1620
|
+
"react-hooks-extra": pluginReactHooksExtra,
|
|
1621
|
+
"react-naming-convention": pluginReactNamingConvention,
|
|
1622
|
+
"react-web-api": pluginReactWebApi,
|
|
1601
1623
|
"react-hooks": pluginReactHooks,
|
|
1602
1624
|
"react-refresh": pluginReactRefresh,
|
|
1603
1625
|
...enableCompiler ? {
|
|
@@ -1625,74 +1647,18 @@ var react = async (options) => {
|
|
|
1625
1647
|
}
|
|
1626
1648
|
},
|
|
1627
1649
|
rules: {
|
|
1650
|
+
...pluginReactX.configs.recommended.rules,
|
|
1651
|
+
...pluginReactDom.configs.recommended.rules,
|
|
1652
|
+
...pluginReactHooksExtra.configs.recommended.rules,
|
|
1653
|
+
...pluginReactNamingConvention.configs.recommended.rules,
|
|
1654
|
+
...pluginReactWebApi.configs.recommended.rules,
|
|
1628
1655
|
...pluginReactHooks.configs.recommended.rules,
|
|
1629
|
-
// recommended rules from @eslint-react/dom
|
|
1630
|
-
"react-dom/no-children-in-void-dom-elements": "warn",
|
|
1631
|
-
"react-dom/no-dangerously-set-innerhtml": "warn",
|
|
1632
|
-
"react-dom/no-dangerously-set-innerhtml-with-children": "error",
|
|
1633
|
-
"react-dom/no-find-dom-node": "error",
|
|
1634
|
-
"react-dom/no-missing-button-type": "warn",
|
|
1635
|
-
"react-dom/no-missing-iframe-sandbox": "warn",
|
|
1636
|
-
"react-dom/no-namespace": "error",
|
|
1637
|
-
"react-dom/no-render-return-value": "error",
|
|
1638
|
-
"react-dom/no-script-url": "warn",
|
|
1639
|
-
"react-dom/no-unsafe-iframe-sandbox": "warn",
|
|
1640
|
-
"react-dom/no-unsafe-target-blank": "warn",
|
|
1641
|
-
// recommended rules react-hooks
|
|
1642
|
-
"react-hooks/exhaustive-deps": "warn",
|
|
1643
|
-
"react-hooks/rules-of-hooks": "error",
|
|
1644
1656
|
// React Refresh
|
|
1645
1657
|
"react-refresh/only-export-components": "warn",
|
|
1646
1658
|
// React Compiler
|
|
1647
1659
|
...enableCompiler ? {
|
|
1648
1660
|
"react-compiler/react-compiler": "error"
|
|
1649
1661
|
} : {},
|
|
1650
|
-
// recommended rules from @eslint-react/web-api
|
|
1651
|
-
"react-web-api/no-leaked-event-listener": "warn",
|
|
1652
|
-
"react-web-api/no-leaked-interval": "warn",
|
|
1653
|
-
"react-web-api/no-leaked-resize-observer": "warn",
|
|
1654
|
-
"react-web-api/no-leaked-timeout": "warn",
|
|
1655
|
-
// recommended rules from @eslint-react
|
|
1656
|
-
"react/ensure-forward-ref-using-ref": "warn",
|
|
1657
|
-
"react/jsx-no-duplicate-props": "warn",
|
|
1658
|
-
"react/jsx-uses-vars": "warn",
|
|
1659
|
-
"react/no-access-state-in-setstate": "error",
|
|
1660
|
-
"react/no-array-index-key": "warn",
|
|
1661
|
-
"react/no-children-count": "warn",
|
|
1662
|
-
"react/no-children-for-each": "warn",
|
|
1663
|
-
"react/no-children-map": "warn",
|
|
1664
|
-
"react/no-children-only": "warn",
|
|
1665
|
-
"react/no-children-to-array": "warn",
|
|
1666
|
-
"react/no-clone-element": "warn",
|
|
1667
|
-
"react/no-comment-textnodes": "warn",
|
|
1668
|
-
"react/no-component-will-mount": "error",
|
|
1669
|
-
"react/no-component-will-receive-props": "error",
|
|
1670
|
-
"react/no-component-will-update": "error",
|
|
1671
|
-
"react/no-context-provider": "warn",
|
|
1672
|
-
"react/no-create-ref": "error",
|
|
1673
|
-
"react/no-default-props": "error",
|
|
1674
|
-
"react/no-direct-mutation-state": "error",
|
|
1675
|
-
"react/no-duplicate-key": "error",
|
|
1676
|
-
"react/no-forward-ref": "warn",
|
|
1677
|
-
"react/no-implicit-key": "warn",
|
|
1678
|
-
"react/no-missing-key": "error",
|
|
1679
|
-
"react/no-nested-components": "error",
|
|
1680
|
-
"react/no-prop-types": "error",
|
|
1681
|
-
"react/no-redundant-should-component-update": "error",
|
|
1682
|
-
"react/no-set-state-in-component-did-mount": "warn",
|
|
1683
|
-
"react/no-set-state-in-component-did-update": "warn",
|
|
1684
|
-
"react/no-set-state-in-component-will-update": "warn",
|
|
1685
|
-
"react/no-string-refs": "error",
|
|
1686
|
-
"react/no-unsafe-component-will-mount": "warn",
|
|
1687
|
-
"react/no-unsafe-component-will-receive-props": "warn",
|
|
1688
|
-
"react/no-unsafe-component-will-update": "warn",
|
|
1689
|
-
"react/no-unstable-context-value": "warn",
|
|
1690
|
-
"react/no-unstable-default-props": "warn",
|
|
1691
|
-
"react/no-unused-class-component-members": "warn",
|
|
1692
|
-
"react/no-unused-state": "warn",
|
|
1693
|
-
"react/prefer-destructuring-assignment": "warn",
|
|
1694
|
-
"react/prefer-shorthand-boolean": "warn",
|
|
1695
|
-
"react/prefer-shorthand-fragment": "warn",
|
|
1696
1662
|
"jsx-quotes": ["error", "prefer-double"],
|
|
1697
1663
|
"react/react-in-jsx-scope": "off",
|
|
1698
1664
|
"react/jsx-indent": [1, 2],
|
|
@@ -1815,6 +1781,7 @@ var index_default = config;
|
|
|
1815
1781
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1816
1782
|
0 && (module.exports = {
|
|
1817
1783
|
GLOB_ALL_SRC,
|
|
1784
|
+
GLOB_ASTRO_TS,
|
|
1818
1785
|
GLOB_CSS,
|
|
1819
1786
|
GLOB_EXCLUDE,
|
|
1820
1787
|
GLOB_HTML,
|
package/dist/index.d.cts
CHANGED
|
@@ -242,6 +242,7 @@ declare const GLOB_JSONC = "**/*.jsonc";
|
|
|
242
242
|
declare const GLOB_MARKDOWN = "**/*.md";
|
|
243
243
|
declare const GLOB_MDX = "**/*.mdx";
|
|
244
244
|
declare const GLOB_MARKDOWN_CODE = "**/*.md/**/*.?([cm])[jt]s?(x)";
|
|
245
|
+
declare const GLOB_ASTRO_TS = "**/*.astro/*.ts";
|
|
245
246
|
declare const GLOB_VUE = "**/*.vue";
|
|
246
247
|
declare const GLOB_YAML = "**/*.y?(a)ml";
|
|
247
248
|
declare const GLOB_TOML = "**/*.toml";
|
|
@@ -284,4 +285,4 @@ declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
|
284
285
|
} ? U : T>;
|
|
285
286
|
declare function getConfigOptions<T>(options: T): {};
|
|
286
287
|
|
|
287
|
-
export { type Awaitable, type ConfigFn, type ConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MDX, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type GetConfigOption, type IgnoresConfig, type JavascriptConfig, type JsoncConfig, type MarkdownConfig, type OptionsComponentExts, type OptionsConfig, type OptionsHasTypeScript, type OptionsOverrides, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type PrettierConfig, type PrettierRequiredOptions, type TestConfig, type TomlConfig, type TypeScriptConfig, type VueConfig, type YmlConfig, combine, comments, config, config as default, defineConfig, getConfigOptions, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, parserPlain, perfectionist, prettier, sortPackageJson, sortTsconfig, test, toml, typescript, unicorn, vue, yml };
|
|
288
|
+
export { type Awaitable, type ConfigFn, type ConfigItem, GLOB_ALL_SRC, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MDX, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type GetConfigOption, type IgnoresConfig, type JavascriptConfig, type JsoncConfig, type MarkdownConfig, type OptionsComponentExts, type OptionsConfig, type OptionsHasTypeScript, type OptionsOverrides, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type PrettierConfig, type PrettierRequiredOptions, type TestConfig, type TomlConfig, type TypeScriptConfig, type VueConfig, type YmlConfig, combine, comments, config, config as default, defineConfig, getConfigOptions, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, parserPlain, perfectionist, prettier, sortPackageJson, sortTsconfig, test, toml, typescript, unicorn, vue, yml };
|
package/dist/index.d.ts
CHANGED
|
@@ -242,6 +242,7 @@ declare const GLOB_JSONC = "**/*.jsonc";
|
|
|
242
242
|
declare const GLOB_MARKDOWN = "**/*.md";
|
|
243
243
|
declare const GLOB_MDX = "**/*.mdx";
|
|
244
244
|
declare const GLOB_MARKDOWN_CODE = "**/*.md/**/*.?([cm])[jt]s?(x)";
|
|
245
|
+
declare const GLOB_ASTRO_TS = "**/*.astro/*.ts";
|
|
245
246
|
declare const GLOB_VUE = "**/*.vue";
|
|
246
247
|
declare const GLOB_YAML = "**/*.y?(a)ml";
|
|
247
248
|
declare const GLOB_TOML = "**/*.toml";
|
|
@@ -284,4 +285,4 @@ declare function interopDefault<T>(m: Awaitable<T>): Promise<T extends {
|
|
|
284
285
|
} ? U : T>;
|
|
285
286
|
declare function getConfigOptions<T>(options: T): {};
|
|
286
287
|
|
|
287
|
-
export { type Awaitable, type ConfigFn, type ConfigItem, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MDX, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type GetConfigOption, type IgnoresConfig, type JavascriptConfig, type JsoncConfig, type MarkdownConfig, type OptionsComponentExts, type OptionsConfig, type OptionsHasTypeScript, type OptionsOverrides, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type PrettierConfig, type PrettierRequiredOptions, type TestConfig, type TomlConfig, type TypeScriptConfig, type VueConfig, type YmlConfig, combine, comments, config, config as default, defineConfig, getConfigOptions, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, parserPlain, perfectionist, prettier, sortPackageJson, sortTsconfig, test, toml, typescript, unicorn, vue, yml };
|
|
288
|
+
export { type Awaitable, type ConfigFn, type ConfigItem, GLOB_ALL_SRC, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MDX, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type GetConfigOption, type IgnoresConfig, type JavascriptConfig, type JsoncConfig, type MarkdownConfig, type OptionsComponentExts, type OptionsConfig, type OptionsHasTypeScript, type OptionsOverrides, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type PrettierConfig, type PrettierRequiredOptions, type TestConfig, type TomlConfig, type TypeScriptConfig, type VueConfig, type YmlConfig, combine, comments, config, config as default, defineConfig, getConfigOptions, ignores, imports, interopDefault, javascript, jsdoc, jsonc, markdown, node, parserPlain, perfectionist, prettier, sortPackageJson, sortTsconfig, test, toml, typescript, unicorn, vue, yml };
|
package/dist/index.js
CHANGED
|
@@ -71,6 +71,7 @@ var GLOB_JSONC = "**/*.jsonc";
|
|
|
71
71
|
var GLOB_MARKDOWN = "**/*.md";
|
|
72
72
|
var GLOB_MDX = "**/*.mdx";
|
|
73
73
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
74
|
+
var GLOB_ASTRO_TS = "**/*.astro/*.ts";
|
|
74
75
|
var GLOB_VUE = "**/*.vue";
|
|
75
76
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
76
77
|
var GLOB_TOML = "**/*.toml";
|
|
@@ -160,10 +161,7 @@ async function imports() {
|
|
|
160
161
|
"import/no-named-default": "error",
|
|
161
162
|
"import/no-self-import": "error",
|
|
162
163
|
"import/no-webpack-loader-syntax": "error",
|
|
163
|
-
"import/newline-after-import": [
|
|
164
|
-
"error",
|
|
165
|
-
{ considerComments: true, count: 1 }
|
|
166
|
-
],
|
|
164
|
+
"import/newline-after-import": ["error", { count: 1 }],
|
|
167
165
|
"import/consistent-type-specifier-style": ["error", "prefer-top-level"]
|
|
168
166
|
}
|
|
169
167
|
}
|
|
@@ -1102,6 +1100,7 @@ var typescript = async (options) => {
|
|
|
1102
1100
|
tsconfigPath,
|
|
1103
1101
|
enableSolid = false
|
|
1104
1102
|
} = options ?? {};
|
|
1103
|
+
const isTypeAware = !!tsconfigPath;
|
|
1105
1104
|
const [pluginTs, parserTs] = await Promise.all([
|
|
1106
1105
|
interopDefault(import("@typescript-eslint/eslint-plugin")),
|
|
1107
1106
|
interopDefault(import("@typescript-eslint/parser"))
|
|
@@ -1140,7 +1139,6 @@ var typescript = async (options) => {
|
|
|
1140
1139
|
"solid/no-unknown-namespaces": "off"
|
|
1141
1140
|
} : {},
|
|
1142
1141
|
"no-dupe-class-members": "off",
|
|
1143
|
-
"no-loss-of-precision": "off",
|
|
1144
1142
|
"no-redeclare": "off",
|
|
1145
1143
|
"no-use-before-define": "off",
|
|
1146
1144
|
"no-useless-constructor": "off",
|
|
@@ -1160,8 +1158,8 @@ var typescript = async (options) => {
|
|
|
1160
1158
|
prefer: "type-imports"
|
|
1161
1159
|
}
|
|
1162
1160
|
],
|
|
1163
|
-
// https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
|
|
1164
1161
|
"@typescript-eslint/method-signature-style": ["error", "property"],
|
|
1162
|
+
// https://www.totaltypescript.com/method-shorthand-syntax-considered-harmful
|
|
1165
1163
|
"@typescript-eslint/no-dupe-class-members": "error",
|
|
1166
1164
|
"@typescript-eslint/no-dynamic-delete": "off",
|
|
1167
1165
|
"@typescript-eslint/no-empty-object-type": [
|
|
@@ -1172,10 +1170,17 @@ var typescript = async (options) => {
|
|
|
1172
1170
|
"@typescript-eslint/no-extraneous-class": "off",
|
|
1173
1171
|
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
1174
1172
|
"@typescript-eslint/no-invalid-void-type": "off",
|
|
1175
|
-
"@typescript-eslint/no-loss-of-precision": "error",
|
|
1176
1173
|
"@typescript-eslint/no-non-null-assertion": "off",
|
|
1177
|
-
"@typescript-eslint/no-redeclare": "error",
|
|
1174
|
+
"@typescript-eslint/no-redeclare": ["error", { builtinGlobals: false }],
|
|
1178
1175
|
"@typescript-eslint/no-require-imports": "error",
|
|
1176
|
+
"@typescript-eslint/no-unused-expressions": [
|
|
1177
|
+
"error",
|
|
1178
|
+
{
|
|
1179
|
+
allowShortCircuit: true,
|
|
1180
|
+
allowTaggedTemplates: true,
|
|
1181
|
+
allowTernary: true
|
|
1182
|
+
}
|
|
1183
|
+
],
|
|
1179
1184
|
"@typescript-eslint/no-unused-vars": "off",
|
|
1180
1185
|
"@typescript-eslint/no-use-before-define": [
|
|
1181
1186
|
"error",
|
|
@@ -1185,10 +1190,19 @@ var typescript = async (options) => {
|
|
|
1185
1190
|
"@typescript-eslint/no-wrapper-object-types": "error",
|
|
1186
1191
|
"@typescript-eslint/triple-slash-reference": "off",
|
|
1187
1192
|
"@typescript-eslint/unified-signatures": "off",
|
|
1188
|
-
...tsconfigPath ? typeAwareRules : {},
|
|
1189
1193
|
...overrides
|
|
1190
1194
|
}
|
|
1191
1195
|
},
|
|
1196
|
+
...isTypeAware ? [
|
|
1197
|
+
{
|
|
1198
|
+
name: "eslint/typescript/rules-type-aware",
|
|
1199
|
+
files: [GLOB_TS, GLOB_TSX],
|
|
1200
|
+
ignores: [`${GLOB_MARKDOWN}/**`, `${GLOB_ASTRO_TS}/**`],
|
|
1201
|
+
rules: {
|
|
1202
|
+
...typeAwareRules
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
] : [],
|
|
1192
1206
|
{
|
|
1193
1207
|
name: "eslint/typescript/dts-overrides",
|
|
1194
1208
|
files: ["**/*.d.ts"],
|
|
@@ -1227,6 +1241,9 @@ async function unicorn() {
|
|
|
1227
1241
|
unicorn: pluginUnicorn
|
|
1228
1242
|
},
|
|
1229
1243
|
rules: {
|
|
1244
|
+
"unicorn/consistent-empty-array-spread": "error",
|
|
1245
|
+
"unicorn/escape-case": "error",
|
|
1246
|
+
"unicorn/new-for-builtins": "error",
|
|
1230
1247
|
// Pass error message when throwing errors
|
|
1231
1248
|
"unicorn/error-message": "error",
|
|
1232
1249
|
// Uppercase regex escapes
|
|
@@ -1234,8 +1251,7 @@ async function unicorn() {
|
|
|
1234
1251
|
"error",
|
|
1235
1252
|
{ checkArrowFunctions: false }
|
|
1236
1253
|
],
|
|
1237
|
-
|
|
1238
|
-
"unicorn/no-instanceof-array": "error",
|
|
1254
|
+
"unicorn/no-instanceof-builtins": "error",
|
|
1239
1255
|
// Ban `new Array` as `Array` constructor's params are ambiguous
|
|
1240
1256
|
"unicorn/no-new-array": "error",
|
|
1241
1257
|
// Prevent deprecated `new Buffer()`
|
|
@@ -1497,23 +1513,28 @@ var react = async (options) => {
|
|
|
1497
1513
|
compiler: enableCompiler = false,
|
|
1498
1514
|
overrides = {}
|
|
1499
1515
|
} = options;
|
|
1500
|
-
const [
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1516
|
+
const [pluginsReact, pluginReactHooks, pluginReactRefresh] = await Promise.all([
|
|
1517
|
+
interopDefault(import("@eslint-react/eslint-plugin")),
|
|
1518
|
+
interopDefault(import("eslint-plugin-react-hooks")),
|
|
1519
|
+
interopDefault(import("eslint-plugin-react-refresh"))
|
|
1520
|
+
]);
|
|
1521
|
+
const plugins = pluginsReact.configs.all.plugins;
|
|
1522
|
+
const {
|
|
1523
|
+
"@eslint-react": pluginReactX,
|
|
1524
|
+
"@eslint-react/dom": pluginReactDom,
|
|
1525
|
+
"@eslint-react/hooks-extra": pluginReactHooksExtra,
|
|
1526
|
+
"@eslint-react/naming-convention": pluginReactNamingConvention,
|
|
1527
|
+
"@eslint-react/web-api": pluginReactWebApi
|
|
1528
|
+
} = plugins;
|
|
1508
1529
|
const _react = [
|
|
1509
1530
|
{
|
|
1510
1531
|
name: "eslint/react/setup",
|
|
1511
1532
|
plugins: {
|
|
1512
|
-
"react":
|
|
1513
|
-
"react-dom":
|
|
1514
|
-
"react-hooks-extra":
|
|
1515
|
-
"react-naming-convention":
|
|
1516
|
-
"react-web-api":
|
|
1533
|
+
"react-x": pluginReactX,
|
|
1534
|
+
"react-dom": pluginReactDom,
|
|
1535
|
+
"react-hooks-extra": pluginReactHooksExtra,
|
|
1536
|
+
"react-naming-convention": pluginReactNamingConvention,
|
|
1537
|
+
"react-web-api": pluginReactWebApi,
|
|
1517
1538
|
"react-hooks": pluginReactHooks,
|
|
1518
1539
|
"react-refresh": pluginReactRefresh,
|
|
1519
1540
|
...enableCompiler ? {
|
|
@@ -1541,74 +1562,18 @@ var react = async (options) => {
|
|
|
1541
1562
|
}
|
|
1542
1563
|
},
|
|
1543
1564
|
rules: {
|
|
1565
|
+
...pluginReactX.configs.recommended.rules,
|
|
1566
|
+
...pluginReactDom.configs.recommended.rules,
|
|
1567
|
+
...pluginReactHooksExtra.configs.recommended.rules,
|
|
1568
|
+
...pluginReactNamingConvention.configs.recommended.rules,
|
|
1569
|
+
...pluginReactWebApi.configs.recommended.rules,
|
|
1544
1570
|
...pluginReactHooks.configs.recommended.rules,
|
|
1545
|
-
// recommended rules from @eslint-react/dom
|
|
1546
|
-
"react-dom/no-children-in-void-dom-elements": "warn",
|
|
1547
|
-
"react-dom/no-dangerously-set-innerhtml": "warn",
|
|
1548
|
-
"react-dom/no-dangerously-set-innerhtml-with-children": "error",
|
|
1549
|
-
"react-dom/no-find-dom-node": "error",
|
|
1550
|
-
"react-dom/no-missing-button-type": "warn",
|
|
1551
|
-
"react-dom/no-missing-iframe-sandbox": "warn",
|
|
1552
|
-
"react-dom/no-namespace": "error",
|
|
1553
|
-
"react-dom/no-render-return-value": "error",
|
|
1554
|
-
"react-dom/no-script-url": "warn",
|
|
1555
|
-
"react-dom/no-unsafe-iframe-sandbox": "warn",
|
|
1556
|
-
"react-dom/no-unsafe-target-blank": "warn",
|
|
1557
|
-
// recommended rules react-hooks
|
|
1558
|
-
"react-hooks/exhaustive-deps": "warn",
|
|
1559
|
-
"react-hooks/rules-of-hooks": "error",
|
|
1560
1571
|
// React Refresh
|
|
1561
1572
|
"react-refresh/only-export-components": "warn",
|
|
1562
1573
|
// React Compiler
|
|
1563
1574
|
...enableCompiler ? {
|
|
1564
1575
|
"react-compiler/react-compiler": "error"
|
|
1565
1576
|
} : {},
|
|
1566
|
-
// recommended rules from @eslint-react/web-api
|
|
1567
|
-
"react-web-api/no-leaked-event-listener": "warn",
|
|
1568
|
-
"react-web-api/no-leaked-interval": "warn",
|
|
1569
|
-
"react-web-api/no-leaked-resize-observer": "warn",
|
|
1570
|
-
"react-web-api/no-leaked-timeout": "warn",
|
|
1571
|
-
// recommended rules from @eslint-react
|
|
1572
|
-
"react/ensure-forward-ref-using-ref": "warn",
|
|
1573
|
-
"react/jsx-no-duplicate-props": "warn",
|
|
1574
|
-
"react/jsx-uses-vars": "warn",
|
|
1575
|
-
"react/no-access-state-in-setstate": "error",
|
|
1576
|
-
"react/no-array-index-key": "warn",
|
|
1577
|
-
"react/no-children-count": "warn",
|
|
1578
|
-
"react/no-children-for-each": "warn",
|
|
1579
|
-
"react/no-children-map": "warn",
|
|
1580
|
-
"react/no-children-only": "warn",
|
|
1581
|
-
"react/no-children-to-array": "warn",
|
|
1582
|
-
"react/no-clone-element": "warn",
|
|
1583
|
-
"react/no-comment-textnodes": "warn",
|
|
1584
|
-
"react/no-component-will-mount": "error",
|
|
1585
|
-
"react/no-component-will-receive-props": "error",
|
|
1586
|
-
"react/no-component-will-update": "error",
|
|
1587
|
-
"react/no-context-provider": "warn",
|
|
1588
|
-
"react/no-create-ref": "error",
|
|
1589
|
-
"react/no-default-props": "error",
|
|
1590
|
-
"react/no-direct-mutation-state": "error",
|
|
1591
|
-
"react/no-duplicate-key": "error",
|
|
1592
|
-
"react/no-forward-ref": "warn",
|
|
1593
|
-
"react/no-implicit-key": "warn",
|
|
1594
|
-
"react/no-missing-key": "error",
|
|
1595
|
-
"react/no-nested-components": "error",
|
|
1596
|
-
"react/no-prop-types": "error",
|
|
1597
|
-
"react/no-redundant-should-component-update": "error",
|
|
1598
|
-
"react/no-set-state-in-component-did-mount": "warn",
|
|
1599
|
-
"react/no-set-state-in-component-did-update": "warn",
|
|
1600
|
-
"react/no-set-state-in-component-will-update": "warn",
|
|
1601
|
-
"react/no-string-refs": "error",
|
|
1602
|
-
"react/no-unsafe-component-will-mount": "warn",
|
|
1603
|
-
"react/no-unsafe-component-will-receive-props": "warn",
|
|
1604
|
-
"react/no-unsafe-component-will-update": "warn",
|
|
1605
|
-
"react/no-unstable-context-value": "warn",
|
|
1606
|
-
"react/no-unstable-default-props": "warn",
|
|
1607
|
-
"react/no-unused-class-component-members": "warn",
|
|
1608
|
-
"react/no-unused-state": "warn",
|
|
1609
|
-
"react/prefer-destructuring-assignment": "warn",
|
|
1610
|
-
"react/prefer-shorthand-boolean": "warn",
|
|
1611
|
-
"react/prefer-shorthand-fragment": "warn",
|
|
1612
1577
|
"jsx-quotes": ["error", "prefer-double"],
|
|
1613
1578
|
"react/react-in-jsx-scope": "off",
|
|
1614
1579
|
"react/jsx-indent": [1, 2],
|
|
@@ -1730,6 +1695,7 @@ var config = defineConfig;
|
|
|
1730
1695
|
var index_default = config;
|
|
1731
1696
|
export {
|
|
1732
1697
|
GLOB_ALL_SRC,
|
|
1698
|
+
GLOB_ASTRO_TS,
|
|
1733
1699
|
GLOB_CSS,
|
|
1734
1700
|
GLOB_EXCLUDE,
|
|
1735
1701
|
GLOB_HTML,
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@debbl/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.10.1",
|
|
5
|
+
"packageManager": "pnpm@10.5.2",
|
|
5
6
|
"description": "Brendan Dash's ESLint config",
|
|
6
7
|
"author": "Brendan Dash <me@aiwan.run> (https://github.com/Debbl/)",
|
|
7
8
|
"license": "MIT",
|
|
@@ -27,18 +28,18 @@
|
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
29
30
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
|
30
|
-
"@eslint-react/eslint-plugin": "^1.30.
|
|
31
|
+
"@eslint-react/eslint-plugin": "^1.30.1",
|
|
31
32
|
"@eslint/markdown": "^6.2.2",
|
|
32
|
-
"@next/eslint-plugin-next": "^15.2.
|
|
33
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
34
|
-
"@typescript-eslint/parser": "^8.
|
|
33
|
+
"@next/eslint-plugin-next": "^15.2.1",
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "^8.26.0",
|
|
35
|
+
"@typescript-eslint/parser": "^8.26.0",
|
|
35
36
|
"@vitest/eslint-plugin": "^1.1.36",
|
|
36
37
|
"eslint-config-flat-gitignore": "^2.1.0",
|
|
37
38
|
"eslint-config-prettier": "^10.0.2",
|
|
38
39
|
"eslint-plugin-import-x": "^4.6.1",
|
|
39
40
|
"eslint-plugin-jsdoc": "^50.6.3",
|
|
40
41
|
"eslint-plugin-jsonc": "^2.19.1",
|
|
41
|
-
"eslint-plugin-n": "^17.16.
|
|
42
|
+
"eslint-plugin-n": "^17.16.2",
|
|
42
43
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
43
44
|
"eslint-plugin-perfectionist": "^4.9.0",
|
|
44
45
|
"eslint-plugin-prettier": "^5.2.3",
|
|
@@ -64,7 +65,7 @@
|
|
|
64
65
|
"@eslint/config-inspector": "^1.0.1",
|
|
65
66
|
"@types/eslint": "^9.6.1",
|
|
66
67
|
"@types/fs-extra": "^11.0.4",
|
|
67
|
-
"@types/node": "^22.13.
|
|
68
|
+
"@types/node": "^22.13.9",
|
|
68
69
|
"@types/react": "^19.0.10",
|
|
69
70
|
"bumpp": "^10.0.3",
|
|
70
71
|
"eslint": "^9.21.0",
|
|
@@ -80,8 +81,8 @@
|
|
|
80
81
|
"scripts": {
|
|
81
82
|
"build": "tsup",
|
|
82
83
|
"stub": "tsup --format esm",
|
|
83
|
-
"dev": "pnpm build && pnpm
|
|
84
|
-
"build:inspector": "pnpm build &&
|
|
84
|
+
"dev": "pnpm build && pnpm exec eslint-config-inspector --config eslint.config.js",
|
|
85
|
+
"build:inspector": "pnpm build && pnpm exec eslint-config-inspector build",
|
|
85
86
|
"watch": "tsup --format esm,cjs --watch",
|
|
86
87
|
"test": "vitest",
|
|
87
88
|
"typecheck": "tsc --noEmit",
|