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

Unclear how to configure this for .mjs files in workspaces #340

Open
runspired opened this issue Sep 7, 2022 · 0 comments
Open

Unclear how to configure this for .mjs files in workspaces #340

runspired opened this issue Sep 7, 2022 · 0 comments

Comments

@runspired
Copy link

Versions: eslint-plugin-node 11.1.0, eslint 8.23.0, node 14.20

Hi, I have a monorepo with a shared root-level eslint configuration. One package in this monorepo is using mjs files. I've configured overrides as best I could guess per the docs, but it seems to pick up neither the node engines property in root nor the (identical) one in the individual package.

{
  "engines": {
    "node": ">= 14.20.* || >= 16",
  }
}

Within the eslintrc.js file mjs files are specified with this override:

{
	settings: {
		'import/extensions': ['.mjs'],
		'import/resolver': {
			node: {
				extensions: ['.mjs'],
			},
		},
	},
	files: ['tools/frontend-migrations/**/*.mjs'],
	parserOptions: {
		ecmaVersion: 2020,
		sourceType: 'module',
	},
	env: {
		browser: false,
		node: true,
	},
	plugins: ['node'],
	extends: ['plugin:node/recommended'],
	rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
		// add your custom rules and overrides for node files here
		'no-console': 'off',

		// this can be removed once the following is fixed
		// https://github.com/mysticatea/eslint-plugin-node/issues/77
		'node/no-unpublished-require': 'off',
	}),
},

As far as I can tell from the docs, mjs should be supported out of the box with these versions and engines hash and at max the above configuration would be needed.

However, instead I get lint errors like the following:

   1:1   error  Import and export declarations are not supported yet  node/no-unsupported-features/es-syntax
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant