Skip to content

Commit 0e9a6c9

Browse files
upgrade correctly to eslint v9 (#465)
* upgrade correctly to eslint v9 * drop Node v16 * add Node v22
1 parent 621409d commit 0e9a6c9

File tree

8 files changed

+1961
-589
lines changed

8 files changed

+1961
-589
lines changed

.eslintrc.json

-25
This file was deleted.

eslint.config.mjs

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
export default [
2+
{
3+
"files": ["bin/tldr"],
4+
"rules": {
5+
"indent": ["error", 2],
6+
"quotes": ["error", "single"],
7+
"linebreak-style": ["error", "unix"],
8+
"semi": ["error", "always"],
9+
"no-console": "off",
10+
"arrow-parens": ["error", "always"],
11+
"arrow-body-style": ["error", "always"],
12+
"array-callback-return": "error",
13+
"no-magic-numbers": ["error", {
14+
"ignore": [-1, 0, 1, 2],
15+
"ignoreArrayIndexes": true,
16+
"detectObjects": true
17+
}],
18+
"no-var": "error",
19+
"no-warning-comments": "warn",
20+
"handle-callback-err": "error"
21+
},
22+
"languageOptions": {
23+
"ecmaVersion": "latest",
24+
"sourceType": "module",
25+
"globals": {
26+
"node": true,
27+
"mocha": true,
28+
"es2019": true
29+
}
30+
}
31+
}
32+
];

lib/cache.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class Cache {
6565
index.rebuildPagesIndex(),
6666
]);
6767
})
68-
// eslint-disable-next-line no-unused-vars
68+
6969
.then(([_, shortIndex]) => {
7070
return shortIndex;
7171
});

lib/errors.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Local cache is empty
1818
Please run tldr --update
1919
`);
2020
this.name = 'EmptyCacheError';
21-
// eslint-disable-next-line no-magic-numbers
21+
2222
this.code = 2;
2323
}
2424
}
@@ -30,7 +30,7 @@ Page not found.
3030
If you want to contribute it, feel free to send a pull request to: ${repo}
3131
`);
3232
this.name = 'MissingPageError';
33-
// eslint-disable-next-line no-magic-numbers
33+
3434
this.code = 3;
3535
}
3636
}
@@ -39,7 +39,7 @@ class MissingRenderPathError extends TldrError {
3939
constructor() {
4040
super('Option --render needs an argument.');
4141
this.name = 'MissingRenderPathError';
42-
// eslint-disable-next-line no-magic-numbers
42+
4343
this.code = 4;
4444
}
4545
}
@@ -48,7 +48,7 @@ class UnsupportedShellError extends TldrError {
4848
constructor(shell, supportedShells) {
4949
super(`Unsupported shell: ${shell}. Supported shells are: ${supportedShells.join(', ')}`);
5050
this.name = 'UnsupportedShellError';
51-
// eslint-disable-next-line no-magic-numbers
51+
5252
this.code = 5;
5353
}
5454
}
@@ -57,7 +57,7 @@ class CompletionScriptError extends TldrError {
5757
constructor(message) {
5858
super(message);
5959
this.name = 'CompletionScriptError';
60-
// eslint-disable-next-line no-magic-numbers
60+
6161
this.code = 6;
6262
}
6363
}

lib/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ module.exports = {
9191
});
9292
},
9393

94-
// eslint-disable-next-line no-magic-numbers
94+
9595
uniqueId(length = 32) {
9696
const size = Math.ceil(length / 2);
9797
return crypto.randomBytes(size).toString('hex').slice(0, length);

0 commit comments

Comments
 (0)