@open-turo/eslint-config-typescript 17.0.13 → 18.0.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.
@@ -0,0 +1,3 @@
1
+ # Breaking changes in v18
2
+
3
+ Adds `@typescript-eslint/consistent-type-assertions` configuration, which will raise errors in consumer repos. We have multiple years of relying on `as` casting as a TypeScript work-around (which is dangerous, compared to type-narrowing in runtime code) in our code, so this specific rule change will require a large amount of effort for compliance--even if adding `// eslint-disable` to all existing instances, or adding [eslint-seatbelt](https://www.notion.com/blog/how-we-evolved-our-code-notions-ratcheting-system-using-custom-eslint-rules)--and so we are marking it as a new major version.
package/index.cjs CHANGED
@@ -136,6 +136,11 @@ const typescriptConfig = () =>
136
136
  files: [FILES_TS, FILES_TSX],
137
137
  languageOptions: typescriptLanguageOptions(),
138
138
  rules: {
139
+ /** Forbids `as` casting (that excludes `as const`) to prevent unsafe type casts */
140
+ "@typescript-eslint/consistent-type-assertions": [
141
+ "error",
142
+ { assertionStyle: "never" },
143
+ ],
139
144
  /**
140
145
  * {@link https://typescript-eslint.io/rules/consistent-type-imports | TypeScript ESLint: consistent-type-imports docs}
141
146
  */
package/package.json CHANGED
@@ -55,6 +55,6 @@
55
55
  "access": "public"
56
56
  },
57
57
  "repository": "https://github.com/open-turo/eslint-config-typescript",
58
- "version": "17.0.13",
58
+ "version": "18.0.0",
59
59
  "packageManager": "npm@11.5.1+sha512.232e6f5d9e799bcb486920b3e9ba907fdf96e576cf7e8c9446c8162e33a416096a1d37a9e910d9a918f6b1f606791c99bc6bb61ee2569b496ec74af13d0dbd95"
60
60
  }
package/recommended.cjs CHANGED
@@ -48,6 +48,11 @@ module.exports = {
48
48
  ],
49
49
  root: true,
50
50
  rules: {
51
+ /** Forbids `as` casting (that excludes `as const`) to prevent unsafe type casts */
52
+ "@typescript-eslint/consistent-type-assertions": [
53
+ "error",
54
+ { assertionStyle: "never" },
55
+ ],
51
56
  /**
52
57
  * {@link https://typescript-eslint.io/rules/consistent-type-imports | TypeScript ESLint: consistent-type-imports docs}
53
58
  */
@@ -566,6 +566,12 @@ exports[`validate config the flat config is correct for index.cjs 1`] = `
566
566
  "@typescript-eslint/comma-spacing": [
567
567
  0,
568
568
  ],
569
+ "@typescript-eslint/consistent-type-assertions": [
570
+ 2,
571
+ {
572
+ "assertionStyle": "never",
573
+ },
574
+ ],
569
575
  "@typescript-eslint/consistent-type-imports": [
570
576
  2,
571
577
  {
@@ -3610,6 +3616,12 @@ exports[`validate config the flat config is correct for index.mjs 1`] = `
3610
3616
  "@typescript-eslint/comma-spacing": [
3611
3617
  0,
3612
3618
  ],
3619
+ "@typescript-eslint/consistent-type-assertions": [
3620
+ 2,
3621
+ {
3622
+ "assertionStyle": "never",
3623
+ },
3624
+ ],
3613
3625
  "@typescript-eslint/consistent-type-imports": [
3614
3626
  2,
3615
3627
  {
@@ -6657,6 +6669,12 @@ exports[`validate config the legacy recommended config is correct 1`] = `
6657
6669
  "@typescript-eslint/comma-spacing": [
6658
6670
  "off",
6659
6671
  ],
6672
+ "@typescript-eslint/consistent-type-assertions": [
6673
+ "error",
6674
+ {
6675
+ "assertionStyle": "never",
6676
+ },
6677
+ ],
6660
6678
  "@typescript-eslint/consistent-type-imports": [
6661
6679
  "error",
6662
6680
  {