Skip to content

Commit b885f81

Browse files
Run local CLI rules with Oxlint
1 parent 256a658 commit b885f81

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

‎oxlint.json‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
"node",
88
"unicorn"
99
],
10+
"jsPlugins": [
11+
{
12+
"name": "@shopify/cli",
13+
"specifier": "./packages/eslint-plugin-cli/index.js"
14+
}
15+
],
1016
"categories": {
1117
"correctness": "off"
1218
},
@@ -332,6 +338,18 @@
332338
"node/no-new-require": "error",
333339
"node/no-path-concat": "error",
334340
"node/no-exports-assign": "error",
341+
"@shopify/cli/command-flags-with-env": "error",
342+
"@shopify/cli/command-conventional-flag-env": "error",
343+
"@shopify/cli/command-reserved-flags": "error",
344+
"@shopify/cli/no-error-factory-functions": "error",
345+
"@shopify/cli/no-process-cwd": "error",
346+
"@shopify/cli/no-trailing-js-in-cli-kit-imports": "error",
347+
"@shopify/cli/no-vi-manual-mock-clear": "error",
348+
"@shopify/cli/no-vi-mock-in-callbacks": "error",
349+
"@shopify/cli/prompt-message-format": "error",
350+
"@shopify/cli/banner-headline-format": "error",
351+
"@shopify/cli/required-fields-when-loading-app": "error",
352+
"@shopify/cli/no-inline-graphql": "error",
335353
"typescript/consistent-return": "error",
336354
"typescript/dot-notation": [
337355
"error",

‎packages/eslint-plugin-cli/rules/no-inline-graphql.js‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,12 @@ function hashFileSync(filePath, algorithm = 'sha256') {
4848

4949
function checkKnownFailuresIfShouldFail(context) {
5050
const filePath = context.filename || context.getFilename()
51-
const relativePath = path.relative(path.resolve(__dirname, '../../../../../../..'), filePath)
52-
const fileHash = hashFileSync(filePath)
51+
const absoluteFilePath = path.resolve(filePath)
52+
const normalizedFilePath = absoluteFilePath.split(path.sep).join('/')
53+
const relativePath = Object.keys(knownFailures).find((knownFailurePath) =>
54+
normalizedFilePath.endsWith(knownFailurePath),
55+
)
56+
const fileHash = hashFileSync(absoluteFilePath)
5357
const shouldFail = !knownFailures[relativePath] || knownFailures[relativePath] !== fileHash
5458

5559
if (shouldFail) {

0 commit comments

Comments
 (0)