Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: avoid nodejs modules #487

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
13 changes: 13 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import eslint from '@eslint/js'
import prettierRecommended from 'eslint-plugin-prettier/recommended'
// eslint-disable-next-line import/no-unresolved
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is due to import-js/eslint-plugin-import#1485 which includes a fix that works for me (locally) but produces a couple extra warnings.

import tseslint from 'typescript-eslint'
import { flatConfigs as pluginImport } from 'eslint-plugin-import'
import globals from 'globals'

export default tseslint.config(
Expand All @@ -11,6 +13,9 @@ export default tseslint.config(
},
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
pluginImport.recommended,
// @ts-expect-error not sure why the plugin isn't type correctly, but it works...
Copy link
Contributor

Choose a reason for hiding this comment

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

I removed this after including the fix mentioned above and did not see any errors.

pluginImport.typescript,
prettierRecommended,
{
languageOptions: {
Expand All @@ -25,6 +30,14 @@ export default tseslint.config(
},
rules: {
'@typescript-eslint/explicit-function-return-type': 'error',
'import/no-nodejs-modules': 'error',
},
},
{
files: ['lib/__tests__/**', 'test/**'],
rules: {
// We only run tests in node, so we can use node's builtins
'import/no-nodejs-modules': 'off',
},
},
{
Expand Down
Loading
Loading