-
Notifications
You must be signed in to change notification settings - Fork 209
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
Audit ESLint rules. I got 99 problems, but they seem to be JSDoc themed. #3035
Comments
Oops, that's my fault. We should probably disable the former, and apply the configuration we currently have for that rule to the TS version. Unless the TS version doesn't lint JS files, which I'm not sure about. |
Actually, I built a quick little ESLint error/warning summarizer and ran it against the nextjs branch. import cp from "node:child_process";
import { inspect } from "node:util";
const ERROR_REGEXP = /^\s+\d+:\d+\s+(warning|error)\s+.*\s(.*?)$/i;
const errorMap = {};
let summary;
try {
cp.execSync("npm run lint:js");
} catch (err) {
const stderr = err.stdout.toString().split("\n");
for (const line of stderr) {
if (ERROR_REGEXP.test(line)) {
const [, type, rule] = line.match(ERROR_REGEXP);
errorMap[type] = errorMap[type] || {};
errorMap[type][rule] = (errorMap[type][rule] || 0) + 1;
}
if (line.startsWith("✖")) {
summary = line;
}
}
}
console.log(inspect({ ...errorMap, _summary: summary }, { sorted: true })); OUTPUT {
_summary: '✖ 142 problems (5 errors, 137 warnings)',
error: {
'@next/next/no-assign-module-variable': 2,
'n/no-callback-literal': 1,
'no-empty': 2
},
warning: {
'@next/next/no-img-element': 1,
'@typescript-eslint/no-explicit-any': 6,
'@typescript-eslint/no-unused-vars': 20,
'header/header': 2,
'jsdoc/check-param-names': 1,
'jsdoc/no-undefined-types': 13,
'jsdoc/require-param-type': 6,
'jsdoc/require-property-description': 40,
'jsdoc/require-returns': 6,
'jsdoc/require-returns-description': 14,
'jsdoc/require-returns-type': 19,
'jsdoc/valid-types': 9
}
}
|
Was trying to find some ESLint errors in Circle-CI logs for a recent PR and noticed we currently have aboot 133 warnings.
npm run lint:js … ✖ 133 problems (0 errors, 133 warnings) 0 errors and 1 warning potentially fixable with the `--fix` option.
A bit of ugly grep-ing shows that about 99/133 of the warnings are jsdoc/* related.
We should probably either fix or mute those warnings, since it makes finding errors amongst the noise needlessly difficult.
As for the remaining warnings:
Also seems fishy that we have both ESLint
no-unused-vars
and TypeScript-y@typescript-eslint/no-unused-vars
rules enabled. Per the typescript-eslint docs:The text was updated successfully, but these errors were encountered: