-
-
Notifications
You must be signed in to change notification settings - Fork 52
feat(no-sync)!: move ts-declaration-location
to peerDependencies
#451
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -8,14 +8,6 @@ let typeMatchesSpecifier = | |||||||
/** @type {import('ts-declaration-location').default | undefined} */ | ||||||||
(undefined) | ||||||||
|
||||||||
try { | ||||||||
typeMatchesSpecifier = | ||||||||
/** @type {import('ts-declaration-location').default} */ ( | ||||||||
/** @type {unknown} */ (require("ts-declaration-location")) | ||||||||
) | ||||||||
|
||||||||
// eslint-disable-next-line no-empty -- Deliberately left empty. | ||||||||
} catch {} | ||||||||
const getTypeOfNode = require("../util/get-type-of-node") | ||||||||
const getParserServices = require("../util/get-parser-services") | ||||||||
const getFullTypeName = require("../util/get-full-type-name") | ||||||||
|
@@ -124,6 +116,27 @@ module.exports = { | |||||||
const selector = options.allowAtRootLevel | ||||||||
? selectors.map(selector => `:function ${selector}`) | ||||||||
: selectors | ||||||||
|
||||||||
const hasAdvancedIgnores = ignores.some( | ||||||||
ignore => typeof ignore !== "string" | ||||||||
) | ||||||||
|
||||||||
// Only require `ts-declaration-location` if needed and not already required. | ||||||||
if (hasAdvancedIgnores) { | ||||||||
try { | ||||||||
typeMatchesSpecifier ||= | ||||||||
/** @type {import('ts-declaration-location').default} */ ( | ||||||||
/** @type {unknown} */ ( | ||||||||
require("ts-declaration-location") | ||||||||
) | ||||||||
) | ||||||||
} catch { | ||||||||
throw new Error( | ||||||||
'ts-declaration-location not available. Rule "n/no-sync" is configured to use "ignores" option with a non-string value. This requires ts-declaration-location to be available.' | ||||||||
) | ||||||||
} | ||||||||
} | ||||||||
|
||||||||
return { | ||||||||
/** | ||||||||
* @param {import('estree').Identifier & {parent: import('estree').Node}} node | ||||||||
|
@@ -160,12 +173,6 @@ module.exports = { | |||||||
) | ||||||||
} | ||||||||
|
||||||||
if (typeMatchesSpecifier === undefined) { | ||||||||
throw new Error( | ||||||||
'ts-declaration-location not available. Rule "n/no-sync" is configured to use "ignores" option with a non-string value. This requires ts-declaration-location to be available.' | ||||||||
) | ||||||||
} | ||||||||
|
||||||||
type = | ||||||||
type === undefined | ||||||||
? getTypeOfNode(node, parserServices) | ||||||||
|
@@ -177,6 +184,7 @@ module.exports = { | |||||||
: fullName | ||||||||
|
||||||||
if ( | ||||||||
typeMatchesSpecifier && | ||||||||
typeMatchesSpecifier( | ||||||||
Comment on lines
+187
to
188
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we can use optional chaining here?
Suggested change
|
||||||||
parserServices.program, | ||||||||
ignore, | ||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -14,7 +14,17 @@ | |||||||||
"types/index.d.ts" | ||||||||||
], | ||||||||||
"peerDependencies": { | ||||||||||
"eslint": ">=8.23.0" | ||||||||||
"eslint": ">=8.23.0", | ||||||||||
"ts-declaration-location": "^1.0.6", | ||||||||||
"typescript": ">=4.8.4" | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should imo either use
Suggested change
Or we should go with v5 as that's the latest version
Suggested change
|
||||||||||
}, | ||||||||||
"peerDependenciesMeta": { | ||||||||||
"ts-declaration-location": { | ||||||||||
"optional": true | ||||||||||
}, | ||||||||||
"typescript": { | ||||||||||
"optional": true | ||||||||||
} | ||||||||||
}, | ||||||||||
"dependencies": { | ||||||||||
"@eslint-community/eslint-utils": "^4.5.0", | ||||||||||
|
@@ -24,8 +34,7 @@ | |||||||||
"globals": "^15.11.0", | ||||||||||
"globrex": "^0.1.2", | ||||||||||
"ignore": "^5.3.2", | ||||||||||
"semver": "^7.6.3", | ||||||||||
"ts-declaration-location": "^1.0.6" | ||||||||||
"semver": "^7.6.3" | ||||||||||
}, | ||||||||||
"devDependencies": { | ||||||||||
"@eslint/js": "^9.14.0", | ||||||||||
|
@@ -52,6 +61,8 @@ | |||||||||
"punycode": "^2.3.1", | ||||||||||
"release-it": "^17.10.0", | ||||||||||
"rimraf": "^5.0.10", | ||||||||||
"sinon": "^21.0.0", | ||||||||||
"ts-declaration-location": "^1.0.6", | ||||||||||
"ts-ignore-import": "^4.0.1", | ||||||||||
"type-fest": "^4.26.1", | ||||||||||
"typescript": "~5.6" | ||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.