Skip to content

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

Open
@runspired

Description

@runspired

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions