-
-
Notifications
You must be signed in to change notification settings - Fork 48
feat: add no-export-load-in-svelte-module-in-kit-pages #281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add no-export-load-in-svelte-module-in-kit-pages #281
Conversation
🦋 Changeset detectedLatest commit: 7d870c0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
package.json
Outdated
@@ -174,7 +174,7 @@ | |||
"access": "public" | |||
}, | |||
"typeCoverage": { | |||
"atLeast": 98.71, | |||
"atLeast": 98.7, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to package.json
check, I couldn't find a way to cover the conditions.
So helplessly, I changed here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's a problem because I think it's a sufficient coverage rate.
ddc46a6
to
08fc369
Compare
const hasSvelteKit = (() => { | ||
try { | ||
const packageJson = JSON.parse(fs.readFileSync("./package.json", "utf8")) | ||
// Hack: CI removes `@sveltejs/kit` and it returns false and test failed. | ||
// So always it returns true if it runs on the package. | ||
if (packageJson.name === "eslint-plugin-svelte") return true | ||
return Boolean( | ||
packageJson.dependencies["@sveltejs/kit"] ?? | ||
packageJson.devDependencies["@sveltejs/kit"], | ||
) | ||
} catch (_e) { | ||
return false | ||
} | ||
})() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a user doesn't use SvelteKit, I don't want to show an error, so I added to check package.json.
Is it the correct way?
And in the CI removes SvelteKit, so for the test, I added chack logic with packageJson.name
I think this is a bad idea but I don't have a better idea.
If correct, I will move it to utils for other SvelteKit-related rules.
module.exports = { | ||
// ... | ||
settings: { | ||
kit: { | ||
files: { | ||
routes: "src/routes", | ||
}, | ||
}, | ||
}, | ||
// ... | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I choose that I added shared configuration for kit routes path.
I think over 95% of users use default settings src/routes
.
So only a few users need to config it.
And for 5% users, we discussed that we will use espree
but it may fail to get the path if they rely to env of some external information. So for now I didn't implement this logic.
#241 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you for your wonderful work!
resolve: #241