Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ module.exports = {
jest: true
},
rules: {
'no-proto': 0,
strict: 0,
'max-len': 0,
'no-proto': 0
},
plugins: ['jest']
};
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

strategy:
matrix:
node-version: [12.x]
node-version: [20.x]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow matrix only includes Node 20.x. Consider expanding this to include at least the current LTS (for example, 18.x) so your tests run against multiple supported Node versions and surface compatibility issues earlier. If you intentionally want to test only Node 20, add a short comment explaining that decision.


steps:
- uses: actions/checkout@v2
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/test.yml-template
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test

on:
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
22 changes: 22 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import globals from "globals";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're using top-level ES module syntax (import / export default) here. Ensure your project is configured for ESM (package.json contains "type": "module") or convert this file to CommonJS (const globals = require('globals') / module.exports = [...]). If your environment doesn't support ESM, ESLint will fail to load this config. Also, note that the globals package is CommonJS — when using ESM interop you may want to import it as import * as globals from 'globals' to avoid getting undefined (depending on your bundler/Node version).

import pluginJs from "@eslint/js";

export default [
pluginJs.configs.recommended,
{
languageOptions: {
globals: {
...globals.node,
...globals.jest,
Comment on lines +8 to +10
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

languageOptions.globals in the flat config usually expects values like "readonly" or "writable" (strings). The globals package exports objects whose values are booleans (or may not match the string form). Spreading ...globals.node and ...globals.jest here will put those boolean values into the config which may not be interpreted as intended by ESLint. Consider mapping them, for example:

const mapToReadonly = (g) => Object.fromEntries(Object.keys(g).map(k => [k, 'readonly']));
...
globals: {
  ...mapToReadonly(globals.node),
  ...mapToReadonly(globals.jest),
},

Or verify your ESLint version accepts boolean globals in the flat config format.

},
ecmaVersion: "latest",
sourceType: "module",
},
rules: {
"no-unused-vars": "warn",
"no-console": "off",
"semi": ["error", "always"],
"quotes": ["error", "single"],
},
},
];
Loading