-
-
Notifications
You must be signed in to change notification settings - Fork 7
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: use typescript #60
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #60 +/- ##
==========================================
+ Coverage 96.96% 97.44% +0.48%
==========================================
Files 13 14 +1
Lines 2111 2626 +515
Branches 396 406 +10
==========================================
+ Hits 2047 2559 +512
- Misses 63 66 +3
Partials 1 1 ☔ View full report in Codecov by Sentry. |
a163a5c
to
5c60276
Compare
src/reference-tracker.ts
Outdated
@@ -49,23 +71,105 @@ function isPassThrough(node) { | |||
} | |||
} | |||
|
|||
export interface ReferenceTrackerOptions { |
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.
export interface ReferenceTrackerOptions { | |
export type ReferenceTrackerOptions = { |
src/has-side-effect.ts
Outdated
/** | ||
* Options for `hasSideEffect`, optionally. | ||
*/ | ||
export interface HasSideEffectOptions { |
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.
export interface HasSideEffectOptions { | |
export type HasSideEffectOptions = { |
@MichaelDeBoey Sorry for the delay. Thank you for checking this PR. |
@eslint-community/mysticatea/eslint-comments/no-use:0, | ||
@eslint-community/mysticatea/ts/no-unsafe-assignment:0, | ||
@eslint-community/mysticatea/ts/no-unsafe-argument:0, | ||
@eslint-community/mysticatea/ts/no-unsafe-return:0, | ||
@eslint-community/mysticatea/ts/no-unsafe-member-access:0, | ||
@eslint-community/mysticatea/ts/no-unsafe-call:0, |
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.
@eslint-community/mysticatea/eslint-comments/no-use:0, | |
@eslint-community/mysticatea/ts/no-unsafe-assignment:0, | |
@eslint-community/mysticatea/ts/no-unsafe-argument:0, | |
@eslint-community/mysticatea/ts/no-unsafe-return:0, | |
@eslint-community/mysticatea/ts/no-unsafe-member-access:0, | |
@eslint-community/mysticatea/ts/no-unsafe-call:0, | |
@eslint-community/mysticatea/eslint-comments/no-use:off, | |
@eslint-community/mysticatea/ts/no-unsafe-assignment:off, | |
@eslint-community/mysticatea/ts/no-unsafe-argument:off, | |
@eslint-community/mysticatea/ts/no-unsafe-return:off, | |
@eslint-community/mysticatea/ts/no-unsafe-member-access:off, | |
@eslint-community/mysticatea/ts/no-unsafe-call:off, |
import type * as ESTree from "estree" | ||
export function getParent(node: ESTree.Node): ESTree.Node | null { | ||
// eslint-disable-next-line @eslint-community/mysticatea/ts/no-unsafe-member-access | ||
return (node as any).parent as ESTree.Node | null |
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.
Can we somehow get rid of the as any
cast?
declare const self: typeof globalThis | ||
declare const window: typeof globalThis | ||
|
||
const globalObject: Record<string, any> = |
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.
We should use unknown
instead of any
https://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html#any
const globalObject: Record<string, any> = | |
const globalObject: Record<string, unknown> = |
*/ | ||
function getPropertyDescriptor(object, name) { | ||
function getPropertyDescriptor(object: any, name: number | string | symbol) { |
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.
function getPropertyDescriptor(object: any, name: number | string | symbol) { | |
function getPropertyDescriptor(object: unknown, name: number | string | symbol) { |
*/ | ||
function isGetter(object, name) { | ||
function isGetter(object: any, name: number | string | symbol) { |
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.
function isGetter(object: any, name: number | string | symbol) { | |
function isGetter(object: unknown, name: number | string | symbol) { |
function replaceF( | ||
matcher: PatternMatcher, | ||
str: string, | ||
replace: (substring: string, ...args: any[]) => string, |
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.
replace: (substring: string, ...args: any[]) => string, | |
replace: (substring: string, ...args: unknown[]) => string, |
[Symbol.replace](str, replacer) { | ||
public [Symbol.replace]( | ||
str: string, | ||
replacer: string | ((substring: string, ...args: any[]) => string), |
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.
replacer: string | ((substring: string, ...args: any[]) => string), | |
replacer: string | ((substring: string, ...args: unknown[]) => string), |
|
||
const IMPORT_TYPE = /^(?:Import|Export(?:All|Default|Named))Declaration$/u | ||
const has = Function.call.bind(Object.hasOwnProperty) | ||
const has = Function.call.bind(Object.hasOwnProperty) as ( | ||
o: any, |
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.
o: any, | |
o: unknown, |
const linter = new eslint.Linter() | ||
let variable = null | ||
let variable: any = null |
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.
let variable: any = null | |
let variable: unknown = null |
) | ||
}, | ||
})) | ||
let actual: any = null |
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.
let actual: any = null | |
let actual: unknown = null |
This PR has been automatically closed because we haven't received a response from the original author 🙈. This automation helps keep the issue tracker clean from PRs that aren't actionable. Please reach out if you have more information for us! 🙂 |
@ota-meshi Shall we continue with this PR? I reopened #150 to track whether we can readd types in a different way |
This PR changes the source code to use typescript.
I also changed it to use unbuild for building. This will allow us to provide bundled
d.ts
.