@shopify/shop-minis-react 0.4.17 → 0.4.18
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/eslint/config.cjs
CHANGED
|
@@ -42,6 +42,7 @@ module.exports = {
|
|
|
42
42
|
'shop-minis/no-env-without-fallback': 'error',
|
|
43
43
|
'shop-minis/no-hardcoded-asset-paths': 'error',
|
|
44
44
|
'shop-minis/no-internal-imports': 'error',
|
|
45
|
+
'shop-minis/no-javascript-files': 'error',
|
|
45
46
|
'shop-minis/no-secrets': ['error'],
|
|
46
47
|
'shop-minis/prefer-sdk-components': 'warn',
|
|
47
48
|
'shop-minis/prefer-sdk-hooks': 'warn',
|
package/eslint/index.cjs
CHANGED
|
@@ -8,6 +8,7 @@ const noDynamicAssetPaths = require('./rules/no-dynamic-asset-paths.cjs')
|
|
|
8
8
|
const noEnvWithoutFallback = require('./rules/no-env-without-fallback.cjs')
|
|
9
9
|
const noHardcodedAssetPaths = require('./rules/no-hardcoded-asset-paths.cjs')
|
|
10
10
|
const noInternalImports = require('./rules/no-internal-imports.cjs')
|
|
11
|
+
const noJavaScriptFiles = require('./rules/no-javascript-files.cjs')
|
|
11
12
|
const noSecrets = require('./rules/no-secrets.cjs')
|
|
12
13
|
const preferSdkComponents = require('./rules/prefer-sdk-components.cjs')
|
|
13
14
|
const preferSdkHooks = require('./rules/prefer-sdk-hooks.cjs')
|
|
@@ -19,6 +20,7 @@ module.exports = {
|
|
|
19
20
|
'no-env-without-fallback': noEnvWithoutFallback,
|
|
20
21
|
'no-hardcoded-asset-paths': noHardcodedAssetPaths,
|
|
21
22
|
'no-internal-imports': noInternalImports,
|
|
23
|
+
'no-javascript-files': noJavaScriptFiles,
|
|
22
24
|
'no-secrets': noSecrets,
|
|
23
25
|
'prefer-sdk-components': preferSdkComponents,
|
|
24
26
|
'prefer-sdk-hooks': preferSdkHooks,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint rule to disallow JavaScript files in Shop Minis projects
|
|
3
|
+
* @fileoverview Require TypeScript files (.ts/.tsx) instead of JavaScript (.js/.jsx)
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
meta: {
|
|
8
|
+
type: 'problem',
|
|
9
|
+
docs: {
|
|
10
|
+
description: 'Disallow JavaScript files - use TypeScript instead',
|
|
11
|
+
category: 'Best Practices',
|
|
12
|
+
recommended: true,
|
|
13
|
+
},
|
|
14
|
+
messages: {
|
|
15
|
+
noJavaScriptFiles:
|
|
16
|
+
'JavaScript files (.js/.jsx) are not allowed in Shop Minis projects. Please rename this file to use TypeScript (.ts/.tsx) instead.',
|
|
17
|
+
},
|
|
18
|
+
schema: [],
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
create(context) {
|
|
22
|
+
const filename = context.filename || context.getFilename()
|
|
23
|
+
|
|
24
|
+
// Skip config files in the root directory
|
|
25
|
+
if (
|
|
26
|
+
filename.endsWith('eslint.config.js') ||
|
|
27
|
+
filename.endsWith('vite.config.js') ||
|
|
28
|
+
filename.endsWith('tailwind.config.js')
|
|
29
|
+
) {
|
|
30
|
+
return {}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
Program(node) {
|
|
35
|
+
if (filename.endsWith('.js') || filename.endsWith('.jsx')) {
|
|
36
|
+
context.report({
|
|
37
|
+
node,
|
|
38
|
+
messageId: 'noJavaScriptFiles',
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
}
|