Skip to content

Commit

Permalink
feat: target ESLint v9
Browse files Browse the repository at this point in the history
  • Loading branch information
Marsup committed Jul 27, 2024
1 parent 945503a commit 2aa0309
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/linter/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

module.exports = {
extends: 'plugin:@hapi/module'
};
const HapiPlugin = require('@hapi/eslint-plugin');

module.exports = [...HapiPlugin.configs.module];
17 changes: 15 additions & 2 deletions lib/linter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,30 @@ exports.lint = async function () {
}

if (!configuration.extensions) {
configuration.extensions = ['.js', '.cjs', '.mjs'];
const extensions = ['js', 'cjs', 'mjs'];

if (configuration.typescript) {
configuration.extensions.push('.ts');
extensions.push('ts');
}

configuration.baseConfig = configuration.baseConfig || [];
configuration.baseConfig.unshift({
files: [`**/*.{${extensions.join(',')}}`],
});
}

if (configuration.typescript) {
delete configuration.typescript;
}

if (configuration.ignores) {
configuration.baseConfig = configuration.baseConfig || [];
configuration.baseConfig.unshift({
ignores: configuration.ignores
});
delete configuration.ignores;
}

let results;
try {
const eslint = new Eslint.ESLint(configuration);
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@hapi/eslint-plugin": "^6.0.0",
"@hapi/hoek": "^11.0.2",
"diff": "^5.0.0",
"eslint": "8.x.x",
"eslint": "9.x.x",
"find-rc": "4.x.x",
"globby": "^11.1.0",
"handlebars": "4.x.x",
Expand All @@ -48,6 +48,7 @@
"devDependencies": {
"@hapi/code": "^9.0.0",
"@hapi/somever": "^4.0.0",
"@types/eslint": "^9.6.0",
"@types/node": "^18.11.17",
"@typescript-eslint/parser": "^5.62.0",
"cpr": "3.x.x",
Expand Down

0 comments on commit 2aa0309

Please sign in to comment.