Skip to content

Commit

Permalink
Upgraded to ESLint v9 (#737)
Browse files Browse the repository at this point in the history
- `.eslintrc.cjs` is no longer supported, moving to `eslint.confg.cjs`
with the new "flat config system".
- `-ext` is no longer supported in CLI
- `.eslintignore` is no longer supported
- `@typescript-eslint/eslint-plugin` is not yet updated to depend on v9
of `eslint`, thus overriding.
  • Loading branch information
thehenrytsai committed May 10, 2024
1 parent 3d1cf4b commit c1736f5
Show file tree
Hide file tree
Showing 5 changed files with 527 additions and 263 deletions.
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

42 changes: 29 additions & 13 deletions .eslintrc.cjs → eslint.config.cjs
@@ -1,17 +1,29 @@
module.exports = {
parser : '@typescript-eslint/parser',
parserOptions : {
ecmaVersion : 'latest', // Allows the use of modern ECMAScript features
sourceType : 'module', // Allows for the use of imports
const tsParser = require("@typescript-eslint/parser");

const tsPlugin = require("@typescript-eslint/eslint-plugin");
const todoPlzPlugin = require('eslint-plugin-todo-plz');

module.exports = [{
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaFeatures: { modules: true },
ecmaVersion: 'latest',
project: './tsconfig.json',
},
},
plugins: [
'@typescript-eslint',
'todo-plz' // for enforcing TODO formatting to require "github.com/TBD54566975/dwn-sdk-js/issues/"
],
env: {
node : true, // Enable Node.js global variables
browser : true
plugins: {
"@typescript-eslint": tsPlugin,
'todo-plz': todoPlzPlugin // for enforcing TODO formatting to require "github.com/TBD54566975/dwn-sdk-js/issues/"
},
files: [
'**/*.ts'
],
// IMPORTANT and confusing: `ignores` only exclude files from the `files` setting.
// To exclude *.js files entirely, you need to have a separate config object altogether. (See another `ignores` below.)
ignores: [
'**/*.d.ts',
],
rules: {
'curly' : ['error', 'all'],
'no-console' : 'off',
Expand Down Expand Up @@ -71,4 +83,8 @@ module.exports = {
// enforce github issue reference for every TO-DO comment
'todo-plz/ticket-ref': ['error', { 'commentPattern': '.*github\.com\/TBD54566975\/dwn-sdk-js\/issues\/.*' }],
}
};
}, {
ignores: [
'**/*.js',
],
}];
1 change: 0 additions & 1 deletion karma.conf.cjs
Expand Up @@ -20,7 +20,6 @@ process.env.FIREFOX_BIN = playwright.firefox.executablePath();
*
* @param {KarmaConfig} config
*/
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
module.exports = function configure(config) {
config.set({
plugins: [
Expand Down

0 comments on commit c1736f5

Please sign in to comment.