@blogic-cz/oxc-config 1.2.0 → 1.4.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.
package/.oxlintrc.ts.json CHANGED
@@ -31,6 +31,16 @@
31
31
  "eslint/no-self-compare": "error",
32
32
  "eslint/no-template-curly-in-string": "error",
33
33
  "eslint/no-var": "error",
34
+ "import/extensions": [
35
+ "error",
36
+ "ignorePackages",
37
+ {
38
+ "js": "never",
39
+ "jsx": "never",
40
+ "ts": "never",
41
+ "tsx": "never"
42
+ }
43
+ ],
34
44
  "import/no-cycle": "error",
35
45
  "import/no-duplicates": "error",
36
46
  "import/no-relative-parent-imports": "error",
@@ -75,6 +85,7 @@
75
85
  "naming/no-console-in-server": "error",
76
86
  "naming/no-dynamic-type-import": "error",
77
87
  "naming/no-server-logger-in-client": "error",
88
+ "naming/no-process-env": "error",
78
89
  "naming/no-undefined-parameter-union": "error",
79
90
  "effect-ts/no-direct-tag-check": "error"
80
91
  },
@@ -116,6 +127,7 @@
116
127
  "import/no-relative-parent-imports": "off",
117
128
  "naming/enforce-props-type-name": "off",
118
129
  "naming/no-default-parameter-values": "off",
130
+ "naming/no-process-env": "off",
119
131
  "naming/no-undefined-parameter-union": "off",
120
132
  "typescript/no-unsafe-type-assertion": "off",
121
133
  "unicorn/no-array-sort": "off"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blogic-cz/oxc-config",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "Shared oxlint and oxfmt configs for blogic projects — layered TypeScript, React, and formatter presets",
5
5
  "keywords": [
6
6
  "oxlint",
@@ -100,6 +100,34 @@ var plugin = {
100
100
  };
101
101
  }
102
102
  },
103
+ "no-process-env": {
104
+ meta: {
105
+ schema: []
106
+ },
107
+ create(context) {
108
+ return {
109
+ MemberExpression(node) {
110
+ if (node.object.type !== "Identifier" || node.object.name !== "process") {
111
+ return;
112
+ }
113
+ const isEnvAccess = !node.computed && node.property.type === "Identifier" && node.property.name === "env" || node.computed && node.property.type === "StringLiteral" && node.property.value === "env";
114
+ if (!isEnvAccess) {
115
+ return;
116
+ }
117
+ const filename = context.filename;
118
+ const parts = filename.split("/");
119
+ const basename = parts.at(-1) ?? "";
120
+ if (basename === "env.ts" || basename.startsWith("env.") || basename === "public-env.ts" || parts.includes("env")) {
121
+ return;
122
+ }
123
+ context.report({
124
+ message: 'Do not access `process.env` directly. Import the typed `env` object from the env module instead (e.g., `import { env } from "@/env/env.server"`).',
125
+ node
126
+ });
127
+ }
128
+ };
129
+ }
130
+ },
103
131
  "no-undefined-parameter-union": {
104
132
  meta: {
105
133
  schema: []
@@ -138,6 +138,55 @@ const plugin: Plugin = {
138
138
  };
139
139
  },
140
140
  },
141
+ "no-process-env": {
142
+ meta: {
143
+ schema: [],
144
+ },
145
+ create(context) {
146
+ return {
147
+ MemberExpression(node) {
148
+ if (
149
+ node.object.type !== "Identifier" ||
150
+ node.object.name !== "process"
151
+ ) {
152
+ return;
153
+ }
154
+
155
+ const isEnvAccess =
156
+ (!node.computed &&
157
+ node.property.type === "Identifier" &&
158
+ node.property.name === "env") ||
159
+ (node.computed &&
160
+ node.property.type === "StringLiteral" &&
161
+ node.property.value === "env");
162
+
163
+ if (!isEnvAccess) {
164
+ return;
165
+ }
166
+
167
+ const filename = context.filename;
168
+ const parts = filename.split("/");
169
+ const basename = parts.at(-1) ?? "";
170
+
171
+ // Allow in env wrapper files
172
+ if (
173
+ basename === "env.ts" ||
174
+ basename.startsWith("env.") ||
175
+ basename === "public-env.ts" ||
176
+ parts.includes("env")
177
+ ) {
178
+ return;
179
+ }
180
+
181
+ context.report({
182
+ message:
183
+ 'Do not access `process.env` directly. Import the typed `env` object from the env module instead (e.g., `import { env } from "@/env/env.server"`).',
184
+ node,
185
+ });
186
+ },
187
+ };
188
+ },
189
+ },
141
190
  "no-undefined-parameter-union": {
142
191
  meta: {
143
192
  schema: [],