@blogic-cz/oxc-config 1.3.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
|
@@ -85,6 +85,7 @@
|
|
|
85
85
|
"naming/no-console-in-server": "error",
|
|
86
86
|
"naming/no-dynamic-type-import": "error",
|
|
87
87
|
"naming/no-server-logger-in-client": "error",
|
|
88
|
+
"naming/no-process-env": "error",
|
|
88
89
|
"naming/no-undefined-parameter-union": "error",
|
|
89
90
|
"effect-ts/no-direct-tag-check": "error"
|
|
90
91
|
},
|
|
@@ -126,6 +127,7 @@
|
|
|
126
127
|
"import/no-relative-parent-imports": "off",
|
|
127
128
|
"naming/enforce-props-type-name": "off",
|
|
128
129
|
"naming/no-default-parameter-values": "off",
|
|
130
|
+
"naming/no-process-env": "off",
|
|
129
131
|
"naming/no-undefined-parameter-union": "off",
|
|
130
132
|
"typescript/no-unsafe-type-assertion": "off",
|
|
131
133
|
"unicorn/no-array-sort": "off"
|
package/package.json
CHANGED
|
@@ -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: [],
|