-
-
Notifications
You must be signed in to change notification settings - Fork 94
fix(sv): align eslint version to 10 accross all addons
#1069
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
463956a
refactor(sv): extract version range stripping code into common util
jonasgeiler 655cbab
fix(sv): replace hard-coded outdated eslint version in prettier addon…
jonasgeiler aa9c156
feat(update-deps): add ability to update `ESLINT_VERSION` constant th…
jonasgeiler 39e7b26
test(sv): suppress expected warnings about unsupported eslint versions
jonasgeiler ad46d98
chore: add changeset
jonasgeiler 5c2545a
minVersion test with semver (+2%)
jycouet 484c3c1
internal move
jycouet a165cab
update imports
jycouet ff5475b
switch to coerceVersion
jycouet a70251f
one checkEslint
jycouet f1be18a
changeset
jycouet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@sveltejs/sv-utils': patch | ||
| --- | ||
|
|
||
| add `minVersion` & `coerceVersion` from `semver`. Deprecate `splitVersion` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'sv': minor | ||
| --- | ||
|
|
||
| fix(sv): align eslint version to `10` accross all addons |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import semverCoerce from 'semver/functions/coerce.js'; | ||
| import semverLt from 'semver/functions/lt.js'; | ||
| import semverMinVersion from 'semver/ranges/min-version.js'; | ||
|
|
||
| type Version = { | ||
| major?: number; | ||
| minor?: number; | ||
| patch?: number; | ||
| /** The clean `major.minor.patch` string. Only populated by `coerceVersion`. */ | ||
| version?: string; | ||
| }; | ||
|
|
||
| /** | ||
| * Returns the lowest version that satisfies the given range, e.g. | ||
| * `^9.0.0` -> `9.0.0`, `~1.2.3` -> `1.2.3`, `workspace:^5.4.3` -> `5.4.3`. | ||
| * Throws on unparseable inputs like `latest` or `workspace:*`. | ||
| */ | ||
| export function minVersion(range: string): string { | ||
| const cleaned = range.replace(/^workspace:/, ''); | ||
| if (cleaned === '*' || cleaned === '') { | ||
| throw new Error(`Cannot determine min version from range: ${range}`); | ||
| } | ||
| const min = semverMinVersion(cleaned); | ||
| if (!min) throw new Error(`Cannot determine min version from range: ${range}`); | ||
| return min.version; | ||
| } | ||
|
|
||
| /** | ||
| * @deprecated Use `coerceVersion` instead. | ||
| */ | ||
| export function splitVersion(str: string): Version { | ||
| const [major, minor, patch] = str?.split('.') ?? []; | ||
|
|
||
| function toVersionNumber(val: string | undefined): number | undefined { | ||
| return val !== undefined && val !== '' && !isNaN(Number(val)) ? Number(val) : undefined; | ||
| } | ||
|
|
||
| return { | ||
| major: toVersionNumber(major), | ||
| minor: toVersionNumber(minor), | ||
| patch: toVersionNumber(patch) | ||
| }; | ||
| } | ||
|
|
||
| /** | ||
| * Parses a version-ish string into `{ major, minor, patch, version }` using `semver.coerce`. | ||
| * `version` is the clean `major.minor.patch` string (e.g. `"9.0.0"` for `^9.0.0`). | ||
| * Understands ranges (`^9.0.0`), partial versions (`18.13`), and `workspace:` prefixes. | ||
| * Returns all-undefined for unparseable input. | ||
| */ | ||
| export function coerceVersion(str: string): Version { | ||
| const c = semverCoerce(str); | ||
| if (!c) return { major: undefined, minor: undefined, patch: undefined, version: undefined }; | ||
| return { major: c.major, minor: c.minor, patch: c.patch, version: c.version }; | ||
| } | ||
|
|
||
| export function isVersionUnsupportedBelow( | ||
| versionStr: string, | ||
| belowStr: string | ||
| ): boolean | undefined { | ||
| const version = semverCoerce(versionStr); | ||
| const below = semverCoerce(belowStr); | ||
| if (!version || !below) return undefined; | ||
| return semverLt(version, below); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.