-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Annoying Lint PR #2 #47
Conversation
'@typescript-eslint/no-empty-function': 'off', | ||
'no-shadow': 'warn', | ||
'prettier/prettier': 'error', | ||
'no-shadow': 'error', |
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.
The real win here. This can be a pretty nasty/hard-to-spot bug, and I’m a big fan of this lint rule.
@@ -0,0 +1 @@ | |||
src/parser/parse/**/*.ts |
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 just disabled linting for code we didn‘t write 🤷🏻
@@ -136,7 +140,7 @@ export async function collectDynamicImports(filename: URL, { astroConfig, loggin | |||
} | |||
|
|||
const defn = components[componentName]; | |||
const fileUrl = new URL(defn.specifier, filename); | |||
const fileUrl = new URL(defn.specifier, importUrl); |
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.
no-shadow
for (const match of matches.reverse()) { | ||
const name = match[1]; | ||
appendImports(name, filename, astroConfig); | ||
for (const foundImport of matches.reverse()) { |
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.
no-shadow
@@ -364,8 +380,8 @@ export async function codegen(ast: Ast, { compileOptions, filename, fileID }: Co | |||
while ((match = regex.exec(code))) { | |||
matches.push(match); | |||
} | |||
for (const match of matches.reverse()) { | |||
const name = match[1]; | |||
for (const astroComponent of matches.reverse()) { |
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.
no-shadow
if (!lastValue) continue; | ||
selectors.push({ start, end: isEnd ? n + 1 : n, value: lastValue }); | ||
start = n + 1; | ||
{ |
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.
no-shadow
// TODO make this pretty. | ||
return error.toString(); | ||
return err.toString(); |
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.
This was a pretty good find for no-shadow! We had a param with the same name as a function.
Yea, I don't know if I'm fully on board with "any is always a lint error/warning". For example, I've been pulling my hair out trying to type the AST walking enter/exit functions. But, if everyones on board with things like |
Just disabled the |
Changes
Enforces the
"no-shadow": "error"
rule, and also adds several missing JSDoc comments.You‘ll notice there are still a lot of
any
warnings in the code. This is where we can negotiate whether or not this is helpful. If it helps us pay down debt (I’ve personally always found a way aroundany
, except in the case of external libraries), let‘s keep it, but if not, let’s ditch it.The goal is to improve code quality. Which should annoy us a little bit, but shouldn‘t just be noise, either.
Testing
Docs