@duro-app/eslint-config 2.0.0 → 2.0.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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/index.js +23 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duro-app/eslint-config",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Shareable ESLint flat config for the Duro stack: base TS conventions, the design-system rules and UI-library policy for React apps, Effect server conventions, and accessibility-first test selectors.",
@@ -49,7 +49,7 @@
49
49
  "eslint-config-prettier": "^10.1.8",
50
50
  "eslint-plugin-react-hooks": "^7.0.1",
51
51
  "typescript-eslint": "^8.56.0",
52
- "@duro-app/eslint-plugin": "^2.0.0"
52
+ "@duro-app/eslint-plugin": "^2.0.1"
53
53
  },
54
54
  "devDependencies": {
55
55
  "eslint": "^9.20.0",
package/src/index.js CHANGED
@@ -68,11 +68,19 @@ export const react = tseslint.config(
68
68
  {
69
69
  name: 'duro-config/react-policy',
70
70
  rules: {
71
- 'no-restricted-imports': [
71
+ // The typescript-eslint version, not the core rule, for `allowTypeImports`.
72
+ // Banning a module by name also catches `import type {X} from 'lexical'`,
73
+ // and a type import erases at compile time: it reaches no runtime module,
74
+ // so it bypasses nothing these bans protect. kb-vision hit exactly that —
75
+ // it uses the wrapper correctly and needed one type the wrapper does not
76
+ // re-export — and had to carry a local override to say so.
77
+ 'no-restricted-imports': 'off',
78
+ '@typescript-eslint/no-restricted-imports': [
72
79
  'error',
73
80
  {
74
81
  patterns: [
75
82
  {
83
+ allowTypeImports: true,
76
84
  group: [
77
85
  'react-aria',
78
86
  'react-aria-components',
@@ -92,6 +100,7 @@ export const react = tseslint.config(
92
100
  message: FOREIGN_UI_MESSAGE,
93
101
  },
94
102
  {
103
+ allowTypeImports: true,
95
104
  group: ['lexical', '@lexical/*'],
96
105
  message: LEXICAL_MESSAGE,
97
106
  },
@@ -113,12 +122,23 @@ export const effect = tseslint.config(...base, {
113
122
  plugins: {'@effect': effectPlugin},
114
123
  rules: {
115
124
  '@effect/no-import-from-barrel-package': 'warn',
116
- 'no-restricted-imports': [
125
+ // See the react preset: type imports erase, so they bypass nothing here.
126
+ // The OTel barrel ban exists because WebSdk's transitive imports crash a
127
+ // Node service *at module load* — which a type import never triggers.
128
+ 'no-restricted-imports': 'off',
129
+ '@typescript-eslint/no-restricted-imports': [
117
130
  'error',
118
131
  {
119
- paths: [{name: '@effect/opentelemetry', message: OTEL_BARREL_MESSAGE}],
132
+ paths: [
133
+ {
134
+ allowTypeImports: true,
135
+ name: '@effect/opentelemetry',
136
+ message: OTEL_BARREL_MESSAGE,
137
+ },
138
+ ],
120
139
  patterns: [
121
140
  {
141
+ allowTypeImports: true,
122
142
  group: ['kysely', 'kysely-*', '@kysely/*'],
123
143
  message: KYSELY_MESSAGE,
124
144
  },