Skip to content

Commit

Permalink
upgrade correctly to eslint v9 (#465)
Browse files Browse the repository at this point in the history
* upgrade correctly to eslint v9

* drop Node v16

* add Node v22
  • Loading branch information
sebastiaanspeck authored Dec 2, 2024
1 parent 621409d commit 0e9a6c9
Show file tree
Hide file tree
Showing 8 changed files with 1,961 additions and 589 deletions.
25 changes: 0 additions & 25 deletions .eslintrc.json

This file was deleted.

32 changes: 32 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
export default [
{
"files": ["bin/tldr"],
"rules": {
"indent": ["error", 2],
"quotes": ["error", "single"],
"linebreak-style": ["error", "unix"],
"semi": ["error", "always"],
"no-console": "off",
"arrow-parens": ["error", "always"],
"arrow-body-style": ["error", "always"],
"array-callback-return": "error",
"no-magic-numbers": ["error", {
"ignore": [-1, 0, 1, 2],
"ignoreArrayIndexes": true,
"detectObjects": true
}],
"no-var": "error",
"no-warning-comments": "warn",
"handle-callback-err": "error"
},
"languageOptions": {
"ecmaVersion": "latest",
"sourceType": "module",
"globals": {
"node": true,
"mocha": true,
"es2019": true
}
}
}
];
2 changes: 1 addition & 1 deletion lib/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class Cache {
index.rebuildPagesIndex(),
]);
})
// eslint-disable-next-line no-unused-vars
.then(([_, shortIndex]) => {
return shortIndex;
});
Expand Down
10 changes: 5 additions & 5 deletions lib/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Local cache is empty
Please run tldr --update
`);
this.name = 'EmptyCacheError';
// eslint-disable-next-line no-magic-numbers
this.code = 2;
}
}
Expand All @@ -30,7 +30,7 @@ Page not found.
If you want to contribute it, feel free to send a pull request to: ${repo}
`);
this.name = 'MissingPageError';
// eslint-disable-next-line no-magic-numbers
this.code = 3;
}
}
Expand All @@ -39,7 +39,7 @@ class MissingRenderPathError extends TldrError {
constructor() {
super('Option --render needs an argument.');
this.name = 'MissingRenderPathError';
// eslint-disable-next-line no-magic-numbers
this.code = 4;
}
}
Expand All @@ -48,7 +48,7 @@ class UnsupportedShellError extends TldrError {
constructor(shell, supportedShells) {
super(`Unsupported shell: ${shell}. Supported shells are: ${supportedShells.join(', ')}`);
this.name = 'UnsupportedShellError';
// eslint-disable-next-line no-magic-numbers
this.code = 5;
}
}
Expand All @@ -57,7 +57,7 @@ class CompletionScriptError extends TldrError {
constructor(message) {
super(message);
this.name = 'CompletionScriptError';
// eslint-disable-next-line no-magic-numbers
this.code = 6;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ module.exports = {
});
},

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

0 comments on commit 0e9a6c9

Please sign in to comment.