@@ -67,19 +67,23 @@ export default [
6767 '@typescript-eslint/no-non-null-assertion' : 'off' ,
6868 '@typescript-eslint/no-unsafe-assignment' : 'off' ,
6969 '@typescript-eslint/no-unsafe-call' : 'off' ,
70+ '@typescript-eslint/no-unsafe-function-type' : level ,
7071 '@typescript-eslint/no-unsafe-member-access' : 'off' ,
7172 '@typescript-eslint/no-unsafe-return' : 'off' ,
7273 '@typescript-eslint/no-unused-vars' : [
7374 level ,
7475 { varsIgnorePattern : '^_' , argsIgnorePattern : '^_|^this$' } ,
7576 ] ,
77+ '@typescript-eslint/no-empty-object-type' : level ,
7678 '@typescript-eslint/no-var-requires' : level ,
7779 '@typescript-eslint/no-unnecessary-type-assertion' : 'off' ,
80+ '@typescript-eslint/no-wrapper-object-types' : level ,
7881 '@typescript-eslint/restrict-template-expressions' : 'off' ,
7982 '@typescript-eslint/triple-slash-reference' : 'off' ,
83+ /** Issue with Prettier https://github.com/prettier/eslint-plugin-prettier/issues/65: */
8084 'arrow-body-style' : 'off' ,
81- camelcase : [ level ] ,
82- curly : 'off' ,
85+ ' camelcase' : [ level ] ,
86+ ' curly' : 'off' ,
8387 'import/no-unresolved' : [
8488 level ,
8589 {
@@ -105,14 +109,36 @@ export default [
105109 'svg' : 'always' ,
106110 } ,
107111 ] ,
112+ 'import/no-restricted-paths' : [
113+ level ,
114+ {
115+ zones : [
116+ {
117+ target : 'src/components/' ,
118+ from : 'src/lib/' ,
119+ message : 'The src/lib directory is for build-time code only.' ,
120+ } ,
121+ {
122+ target : 'src/layouts/' ,
123+ from : 'src/lib/' ,
124+ message : 'The src/lib directory is for build-time code only.' ,
125+ } ,
126+ {
127+ target : 'src/pages/' ,
128+ from : 'src/lib/' ,
129+ message : 'The src/lib directory is for build-time code only.' ,
130+ } ,
131+ ] ,
132+ } ,
133+ ] ,
108134 'import/order' : 'off' ,
109135 'jsdoc/check-indentation' : level ,
110136 'jsdoc/check-line-alignment' : level ,
111137 'jsdoc/check-syntax' : level ,
112138 'jsdoc/check-tag-names' : [
113139 level ,
114140 {
115- definedTags : [ 'NOTE:' , 'jest-environment' , 'jest-environment-options' ] ,
141+ definedTags : [ 'NOTE:' , 'jest-environment' ] ,
116142 jsxTags : true ,
117143 } ,
118144 ] ,
@@ -131,6 +157,7 @@ export default [
131157 'jsdoc/valid-types' : 'off' ,
132158 'new-cap' : [ level , { newIsCap : true , capIsNew : false } ] ,
133159 'no-new' : level ,
160+ 'no-process-env' : level ,
134161 'no-restricted-globals' : [ 'error' ] . concat ( restrictedGlobals ) ,
135162 'no-restricted-imports' : [
136163 'error' , {
@@ -150,13 +177,14 @@ export default [
150177 'no-unused-expressions' : [ level , { allowShortCircuit : true , allowTernary : true } ] ,
151178 'no-unused-vars' : [ level , { varsIgnorePattern : '^_' , argsIgnorePattern : '^_|^this$' } ] ,
152179 'no-useless-escape' : 'off' ,
180+ /** Issue with Prettier https://github.com/prettier/eslint-plugin-prettier/issues/65: */
153181 'prefer-arrow-callback' : 'off' ,
154182 'prefer-object-spread' : level ,
155183 'prefer-spread' : level ,
156184 'security/detect-non-literal-fs-filename' : 'off' ,
157185 'security/detect-object-injection' : 'off' ,
158186 'security/detect-unsafe-regex' : 'off' ,
159- semi : [ 'error' , 'never' ] ,
187+ ' semi' : [ 'error' , 'never' ] ,
160188 } ,
161189 } ,
162190 {
@@ -202,4 +230,49 @@ export default [
202230 camelcase : 'off' ,
203231 } ,
204232 } ,
233+ {
234+ files : [
235+ '.eslintrc.js' ,
236+ 'astro.config.ts' ,
237+ 'playwright.config.ts' ,
238+ 'vitest.setup.ts' ,
239+ 'scripts/build/**/*'
240+ ] ,
241+ rules : {
242+ // All files except Astro config should use import.meta.env.ENV_VAR
243+ 'no-process-env' : 'off' ,
244+ } ,
245+ } ,
246+ {
247+ files : [
248+ 'src/components/**/*' ,
249+ 'src/layouts/**/*' ,
250+ 'src/pages/**/*' ,
251+ ] ,
252+ rules : {
253+ 'no-restricted-syntax' : [
254+ level ,
255+ {
256+ 'selector' : 'MetaProperty[meta.name="import"][property.name="meta"]' ,
257+ 'message' : 'Do not use import.meta.env directly. Use methods in src/components/scripts/utils like isCI(), isDev(), etc.'
258+ }
259+ ] ,
260+ } ,
261+ } ,
262+ {
263+ files : [
264+ 'src/lib/config/environmentServer.ts' ,
265+ 'src/lib/config/siteUrlServer.ts' ,
266+ 'src/components/scripts/utils/environmentClient.ts' ,
267+ 'src/components/scripts/utils/siteUrlClient.ts' ,
268+ ] ,
269+ rules : {
270+ 'no-restricted-syntax' : [
271+ 'off' ,
272+ {
273+ 'selector' : 'MetaProperty[meta.name="import"][property.name="meta"]' ,
274+ }
275+ ] ,
276+ } ,
277+ } ,
205278]
0 commit comments