eslint-config-tungsten-flat 0.2.2 → 0.2.4

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/NOTES.md ADDED
@@ -0,0 +1,91 @@
1
+ # eslint-config-tungsten-flat — maintenance notes
2
+
3
+ ## `eslint-plugin-no-type-assertion` peer warning
4
+
5
+ ### Symptom
6
+
7
+ Every project that installs this config gets a pnpm peer warning:
8
+
9
+ ```
10
+ ✕ unmet peer eslint
11
+ Installed: 9.39.5
12
+ Wanted:
13
+ "^7.0.0 || ^8.0.0":
14
+ eslint-plugin-no-type-assertion@1.3.0
15
+ ```
16
+
17
+ ### Why it happens
18
+
19
+ This package depends on `eslint-plugin-no-type-assertion@^1.3.0`, whose declared
20
+ peer range stops at ESLint 8. The plugin is unmaintained — 1.3.0 is the last
21
+ release (~2021) — so the range was never bumped for ESLint 9.
22
+
23
+ ### Is it a real incompatibility?
24
+
25
+ No. The plugin is a leaf plugin with no version-coupled ESLint API. Its entire
26
+ entry point is:
27
+
28
+ ```js
29
+ module.exports.rules = {
30
+ "no-type-assertion": require("./rules/no-type-assertion"),
31
+ };
32
+ ```
33
+
34
+ and the rule itself is ~55 lines using only `meta` + `create(context)` with
35
+ `context.report({ node, messageId })` and three AST visitors (`TSTypeAssertion`,
36
+ `TSAsExpression`, `TSNonNullExpression`). All of that is unchanged in ESLint 9.
37
+ The rule is already enabled and firing under ESLint 9 — see
38
+ [`src/index.ts`](src/index.ts), which registers the plugin under the
39
+ `no-type-assertion` namespace and sets
40
+ `"no-type-assertion/no-type-assertion": "warn"`.
41
+
42
+ So the warning is stale metadata, not a broken install.
43
+
44
+ ### Workaround for consumers (current fix)
45
+
46
+ Suppress it in the consuming project. **Note for pnpm 10+/11:** the `pnpm` field
47
+ in `package.json` is no longer read — pnpm warns and ignores it. These settings
48
+ now live in `pnpm-workspace.yaml`:
49
+
50
+ ```yaml
51
+ peerDependencyRules:
52
+ allowedVersions:
53
+ # Unmaintained leaf plugin; its peer range stops at eslint 8 but the rule
54
+ # uses no version-coupled API and works fine on 9.
55
+ 'eslint-plugin-no-type-assertion>eslint': '9'
56
+ ```
57
+
58
+ Applied in `qtc-2` on 2026-07-22.
59
+
60
+ ### Proper fix (not yet done)
61
+
62
+ Vendor the rule into this package and drop the dependency. That fixes the
63
+ warning at source for every consumer instead of requiring each one to suppress
64
+ it. Steps:
65
+
66
+ 1. Copy the rule body into `src/rules/noTypeAssertion.ts` (it is ~55 lines of
67
+ plain JS; typing it against `Rule.RuleModule` is optional).
68
+ 2. Register it inline in `src/index.ts` in place of the imported plugin —
69
+ `{ rules: { 'no-type-assertion': noTypeAssertion } }` — keeping the same
70
+ `no-type-assertion/no-type-assertion` rule id so consumer configs and inline
71
+ disable comments keep working.
72
+ 3. Remove `eslint-plugin-no-type-assertion` from `dependencies` and delete its
73
+ entry from `src/modules.d.ts` (which only exists to silence the missing-types
74
+ error for the untyped plugin).
75
+ 4. Consumers can then drop the `peerDependencyRules` entry above.
76
+
77
+ Licence is MIT (Kirill Korolyov,
78
+ <https://github.com/Dremora/eslint-plugin-no-type-assertion>), so vendoring is
79
+ fine — preserve the copyright notice in the vendored file.
80
+
81
+ ### Possible alternative (unevaluated)
82
+
83
+ `typescript-eslint` has a built-in rule that may cover the same ground:
84
+
85
+ - <https://typescript-eslint.io/rules/consistent-type-assertions/>
86
+
87
+ `typescript-eslint` is already a dependency of this package, so adopting it
88
+ would remove the third-party plugin without vendoring anything. Not yet
89
+ reviewed — the rule's options and exactly how its behaviour compares to
90
+ `no-type-assertion` (particularly the `as const` and non-null `!` cases the
91
+ current rule special-cases) still need checking.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAA+B,MAAM,EAAE,MAAM,eAAe,CAAA;;AAMnE,wBAoFE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAA+B,MAAM,EAAE,MAAM,eAAe,CAAA;;AAMnE,wBA+FE"}
package/dist/index.js CHANGED
@@ -61,7 +61,9 @@ export default defineConfig([
61
61
  "@typescript-eslint/no-explicit-any": "off",
62
62
  // would like to change to _unused or unused_, but conflicts with the camel case rule
63
63
  //"@typescript-eslint/no-unused-vars": ["warn", { "varsIgnorePattern": "^__*$|^unused$|^unused|.+unused$", "argsIgnorePattern": "^__*$|^unused$|^unused_.+|.+_unused$|^reject$" }],
64
- "@typescript-eslint/no-unused-vars": ["warn", { "varsIgnorePattern": "^__*$|unused$", "argsIgnorePattern": "^__*$|unused$|^reject$" }],
64
+ // "^_" (any leading underscore) subsumes the older "^__*$" (which only matched a
65
+ // name that was entirely underscores), and covers the `_name` convention too
66
+ "@typescript-eslint/no-unused-vars": ["warn", { "varsIgnorePattern": "^_|unused$", "argsIgnorePattern": "^_|unused$|^reject$" }],
65
67
  "@typescript-eslint/switch-exhaustiveness-check": "warn",
66
68
  "@typescript-eslint/require-await": "warn",
67
69
  "@typescript-eslint/no-unsafe-member-access": "warn",
@@ -69,6 +71,13 @@ export default defineConfig([
69
71
  "@typescript-eslint/no-unused-expressions": "warn",
70
72
  // added TS rules
71
73
  '@typescript-eslint/no-misused-spread': 'warn',
74
+ // fires on every event handler and JSX prop taking an async function,
75
+ // which is the normal shape in a tungsten app
76
+ '@typescript-eslint/no-misused-promises': 'off',
77
+ '@typescript-eslint/no-for-in-array': 'off',
78
+ '@typescript-eslint/no-floating-promises': 'warn',
79
+ // these can give false positives due to eslint info being stale
80
+ '@typescript-eslint/no-unsafe-assignment': 'warn',
72
81
  // plugin-no-type-assertion
73
82
  "no-type-assertion/no-type-assertion": "warn",
74
83
  // was using this in a project, but doesn't seem to change the underlying config
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "eslint-config-tungsten-flat",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "keywords": [],
8
8
  "author": "",
9
- "license": "UNLICENSED",
9
+ "license": "ISC",
10
10
  "dependencies": {
11
11
  "@typescript-eslint/parser": "^8.57.1",
12
12
  "eslint": "^9.39.4",
@@ -31,6 +31,6 @@
31
31
  "scripts": {
32
32
  "compile": "tsc",
33
33
  "build": "tsc --watch",
34
- "prepublish": "tsc"
34
+ "prepublishonly": "tsc"
35
35
  }
36
36
  }
package/src/index.ts CHANGED
@@ -70,7 +70,9 @@ export default defineConfig([
70
70
  "@typescript-eslint/no-explicit-any": "off",
71
71
  // would like to change to _unused or unused_, but conflicts with the camel case rule
72
72
  //"@typescript-eslint/no-unused-vars": ["warn", { "varsIgnorePattern": "^__*$|^unused$|^unused|.+unused$", "argsIgnorePattern": "^__*$|^unused$|^unused_.+|.+_unused$|^reject$" }],
73
- "@typescript-eslint/no-unused-vars": ["warn", { "varsIgnorePattern": "^__*$|unused$", "argsIgnorePattern": "^__*$|unused$|^reject$" }],
73
+ // "^_" (any leading underscore) subsumes the older "^__*$" (which only matched a
74
+ // name that was entirely underscores), and covers the `_name` convention too
75
+ "@typescript-eslint/no-unused-vars": ["warn", { "varsIgnorePattern": "^_|unused$", "argsIgnorePattern": "^_|unused$|^reject$" }],
74
76
  "@typescript-eslint/switch-exhaustiveness-check": "warn",
75
77
  "@typescript-eslint/require-await": "warn",
76
78
  "@typescript-eslint/no-unsafe-member-access": "warn",
@@ -80,6 +82,15 @@ export default defineConfig([
80
82
  // added TS rules
81
83
  '@typescript-eslint/no-misused-spread': 'warn',
82
84
 
85
+ // fires on every event handler and JSX prop taking an async function,
86
+ // which is the normal shape in a tungsten app
87
+ '@typescript-eslint/no-misused-promises': 'off',
88
+ '@typescript-eslint/no-for-in-array': 'off',
89
+ '@typescript-eslint/no-floating-promises': 'warn',
90
+
91
+ // these can give false positives due to eslint info being stale
92
+ '@typescript-eslint/no-unsafe-assignment': 'warn',
93
+
83
94
  // plugin-no-type-assertion
84
95
  "no-type-assertion/no-type-assertion": "warn",
85
96