eslint-config-tungsten-flat 0.2.4 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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,wBA+FE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAA+B,MAAM,EAAE,MAAM,eAAe,CAAA;;AAKnE,wBA0FE"}
package/dist/index.js CHANGED
@@ -2,7 +2,6 @@ import { defineConfig, globalIgnores } from 'eslint/config';
2
2
  //export type { CompatibleConfigArray } from 'typescript-eslint' // would use this instead of `as ConfigArray` if typescript-eslint exported this type
3
3
  import tungstenJs from 'eslint-config-tungsten-js-flat';
4
4
  import tseslint from 'typescript-eslint';
5
- import pluginNoTypeAssertion from 'eslint-plugin-no-type-assertion';
6
5
  export default defineConfig([
7
6
  {
8
7
  extends: [tungstenJs]
@@ -29,11 +28,6 @@ export default defineConfig([
29
28
  //"plugin:@typescript-eslint/recommended",
30
29
  //"plugin:import/typescript",
31
30
  globalIgnores([".tungsten"]),
32
- {
33
- plugins: {
34
- 'no-type-assertion': pluginNoTypeAssertion
35
- }
36
- },
37
31
  {
38
32
  "rules": {
39
33
  "prefer-const": "warn", // this is set in tungsten-js already, but for some reason gets reset to error
@@ -42,15 +36,15 @@ export default defineConfig([
42
36
  // "skipBlankLines": true,
43
37
  // "ignoreComments": true
44
38
  // }],
45
- "import/no-unresolved": "off", // bugs out with typescript, + typescript does this already
46
- "import/extensions": ["off"], // imports of external packages may require extension-less imports due to exports config
39
+ "import-x/no-unresolved": "off", // bugs out with typescript, + typescript does this already
40
+ "import-x/extensions": ["off"], // imports of external packages may require extension-less imports due to exports config
47
41
  //"@typescript-eslint/ban-types": "warn", // removed
48
42
  // which one to use? this had warn, but a project had it off
49
43
  "@typescript-eslint/no-empty-object-type": "warn",
50
44
  //"@typescript-eslint/no-empty-object-type": "off",
51
45
  "@typescript-eslint/no-unsafe-function-type": "warn",
52
46
  "@typescript-eslint/no-wrapper-object-types": "warn",
53
- "@typescript-eslint/no-empty-interface": "warn",
47
+ //"@typescript-eslint/no-empty-interface": "warn", // deprecated, superseded by no-empty-object-type above
54
48
  "@typescript-eslint/no-empty-function": "off",
55
49
  "@typescript-eslint/no-namespace": "warn",
56
50
  "@typescript-eslint/no-unnecessary-type-assertion": "warn",
@@ -78,8 +72,8 @@ export default defineConfig([
78
72
  '@typescript-eslint/no-floating-promises': 'warn',
79
73
  // these can give false positives due to eslint info being stale
80
74
  '@typescript-eslint/no-unsafe-assignment': 'warn',
81
- // plugin-no-type-assertion
82
- "no-type-assertion/no-type-assertion": "warn",
75
+ // replaces the old plugin-no-type-assertion rule: permits widening, flags narrowing
76
+ "@typescript-eslint/no-unsafe-type-assertion": "warn",
83
77
  // was using this in a project, but doesn't seem to change the underlying config
84
78
  //"react/no-unknown-property": ["warn", { ignore: ["for"] }]
85
79
  "react/no-unknown-property": "off"
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "eslint-config-tungsten-flat",
3
- "version": "0.2.4",
3
+ "version": "0.3.0",
4
4
  "description": "",
5
5
  "type": "module",
6
+ "files": [
7
+ "dist"
8
+ ],
6
9
  "main": "dist/index.js",
7
10
  "keywords": [],
8
11
  "author": "",
9
12
  "license": "ISC",
10
13
  "dependencies": {
11
- "@typescript-eslint/parser": "^8.57.1",
12
- "eslint": "^9.39.4",
13
- "eslint-config-tungsten-js-flat": "^0.2.0",
14
- "eslint-plugin-no-type-assertion": "^1.3.0",
14
+ "eslint-config-tungsten-js-flat": "^0.3.0",
15
15
  "typescript-eslint": "^8.57.1"
16
16
  },
17
17
  "peerDependencies": {
18
- "eslint": "^9.39.4"
18
+ "eslint": "^9.0.0 || ^10.0.0"
19
19
  },
20
20
  "__OldPeerDependencies": {
21
21
  "@babel/core": "^7.18.5",
@@ -26,11 +26,11 @@
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^22.19.15",
29
+ "eslint": "^9.39.4",
29
30
  "typescript": "^5.9.3"
30
31
  },
31
32
  "scripts": {
32
33
  "compile": "tsc",
33
- "build": "tsc --watch",
34
- "prepublishonly": "tsc"
34
+ "build": "tsc --watch"
35
35
  }
36
36
  }
package/NOTES.md DELETED
@@ -1,91 +0,0 @@
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.
package/dist/test.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":""}
package/dist/test.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
package/src/index.ts DELETED
@@ -1,105 +0,0 @@
1
-
2
- import { defineConfig, globalIgnores, Config } from 'eslint/config'
3
- //export type { CompatibleConfigArray } from 'typescript-eslint' // would use this instead of `as ConfigArray` if typescript-eslint exported this type
4
- import tungstenJs from 'eslint-config-tungsten-js-flat'
5
- import tseslint from 'typescript-eslint'
6
- import pluginNoTypeAssertion from 'eslint-plugin-no-type-assertion'
7
-
8
- export default defineConfig([
9
- {
10
- extends: [tungstenJs]
11
- },
12
- //...tungstenJs,
13
- ///...tseslint.configs.recommended,
14
- tseslint.configs.recommendedTypeChecked as Config[],
15
- {
16
- languageOptions: {
17
- parserOptions: {
18
- //projectService: true,
19
- projectService: {
20
- allowDefaultProject: [
21
- '*.config.js',
22
- //'eslint.config.js',
23
- //'tungsten.config.js',
24
- //'sxy-test-runner.config.js'
25
- ],
26
- },
27
- //tsconfigRootDir: import.meta.dirname,
28
- },
29
- },
30
- },
31
-
32
- //"plugin:@typescript-eslint/recommended",
33
- //"plugin:import/typescript",
34
- globalIgnores([".tungsten"]),
35
- {
36
- plugins: {
37
- 'no-type-assertion': pluginNoTypeAssertion
38
- }
39
- },
40
- {
41
- "rules": {
42
- "prefer-const": "warn", // this is set in tungsten-js already, but for some reason gets reset to error
43
-
44
- // //// style
45
- // "no-trailing-spaces" : ["warn", {
46
- // "skipBlankLines": true,
47
- // "ignoreComments": true
48
- // }],
49
-
50
- "import/no-unresolved": "off", // bugs out with typescript, + typescript does this already
51
- "import/extensions": ["off"], // imports of external packages may require extension-less imports due to exports config
52
-
53
- //"@typescript-eslint/ban-types": "warn", // removed
54
-
55
- // which one to use? this had warn, but a project had it off
56
- "@typescript-eslint/no-empty-object-type": "warn",
57
- //"@typescript-eslint/no-empty-object-type": "off",
58
-
59
- "@typescript-eslint/no-unsafe-function-type": "warn",
60
- "@typescript-eslint/no-wrapper-object-types": "warn",
61
-
62
- "@typescript-eslint/no-empty-interface": "warn",
63
- "@typescript-eslint/no-empty-function": "off",
64
- "@typescript-eslint/no-namespace": "warn",
65
- "@typescript-eslint/no-unnecessary-type-assertion": "warn",
66
- "@typescript-eslint/strict-boolean-expressions": "warn",
67
- "@typescript-eslint/no-this-alias": "warn",
68
- "@typescript-eslint/ban-ts-comment": "off",
69
- "@typescript-eslint/no-inferrable-types": "off",
70
- "@typescript-eslint/no-explicit-any": "off",
71
- // would like to change to _unused or unused_, but conflicts with the camel case rule
72
- //"@typescript-eslint/no-unused-vars": ["warn", { "varsIgnorePattern": "^__*$|^unused$|^unused|.+unused$", "argsIgnorePattern": "^__*$|^unused$|^unused_.+|.+_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$" }],
76
- "@typescript-eslint/switch-exhaustiveness-check": "warn",
77
- "@typescript-eslint/require-await": "warn",
78
- "@typescript-eslint/no-unsafe-member-access": "warn",
79
- "@typescript-eslint/no-unsafe-call": "warn",
80
- "@typescript-eslint/no-unused-expressions": "warn",
81
-
82
- // added TS rules
83
- '@typescript-eslint/no-misused-spread': 'warn',
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
-
94
- // plugin-no-type-assertion
95
- "no-type-assertion/no-type-assertion": "warn",
96
-
97
- // was using this in a project, but doesn't seem to change the underlying config
98
- //"react/no-unknown-property": ["warn", { ignore: ["for"] }]
99
- "react/no-unknown-property": "off"
100
- },
101
- }
102
-
103
- ])
104
-
105
-
package/src/modules.d.ts DELETED
@@ -1,2 +0,0 @@
1
-
2
- declare module 'eslint-plugin-no-type-assertion'
package/tsconfig.json DELETED
@@ -1,104 +0,0 @@
1
- {
2
- "include": ["src"],
3
- "compilerOptions": {
4
- /* Visit https://aka.ms/tsconfig to read more about this file */
5
-
6
- /* Projects */
7
- // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
8
- // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
9
- // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
10
- // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
11
- // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
12
- // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
13
-
14
- /* Language and Environment */
15
- "target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
16
- // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
17
- "jsx": "preserve", /* Specify what JSX code is generated. */
18
- // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
19
- // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
20
- // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
21
- // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
22
- // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
23
- // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
24
- // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
25
- "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
26
- // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
27
-
28
- /* Modules */
29
- "module": "Node16", /* Specify what module code is generated. */
30
- "rootDir": "./src", /* Specify the root folder within your source files. */
31
- // "moduleResolution": "NodeNext", /* Specify how TypeScript looks up a file from a given module specifier. */
32
- // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
33
- // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
34
- // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
35
- // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
36
- // "types": [], /* Specify type package names to be included without being referenced in a source file. */
37
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
38
- // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
39
- "resolveJsonModule": true, /* Enable importing .json files. */
40
- // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
41
-
42
- /* JavaScript Support */
43
- // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
44
- // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
45
- // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
46
-
47
- /* Emit */
48
- "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
49
- "declarationMap": true, /* Create sourcemaps for d.ts files. */
50
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
51
- // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
52
- // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
53
- "outDir": "./dist", /* Specify an output folder for all emitted files. */
54
- // "removeComments": true, /* Disable emitting comments. */
55
- // "noEmit": true, /* Disable emitting files from a compilation. */
56
- // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
57
- // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
58
- // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
59
- // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
60
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
61
- // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
62
- // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
63
- // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
64
- // "newLine": "crlf", /* Set the newline character for emitting files. */
65
- // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
66
- // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
67
- // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
68
- // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
69
- // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
70
- // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
71
-
72
- /* Interop Constraints */
73
- // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
74
- // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
75
- "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
76
- // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
77
- "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
78
-
79
- /* Type Checking */
80
- "strict": true, /* Enable all strict type-checking options. */
81
- // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
82
- // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
83
- // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
84
- // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
85
- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
86
- // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
87
- // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
88
- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
89
- // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
90
- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
91
- "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
92
- // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
93
- // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
94
- "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
95
- // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
96
- // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
97
- // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
98
- // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
99
-
100
- /* Completeness */
101
- // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
102
- "skipLibCheck": true /* Skip type checking all .d.ts files. */
103
- }
104
- }