Skip to content

Commit

Permalink
Drop @babel/eslint-parser
Browse files Browse the repository at this point in the history
@babel/eslint-parser does not parse correctly ES modules, throwing the following error:

> Parsing error: You appear to be using a native ECMAScript module configuration file, which is only supported when running Babel asynchronously or when using the Node.js `--experimental-require-module` flag

This error is thrown even with `sourceType` set to `module`.

Per @babel/eslint-parser README:

> You only need to use @babel/eslint-parser if you are using Babel to transform your code.

As the default parser does not cause this problem, so no reason to keep an extra dependency.
  • Loading branch information
amikheychik committed Dec 31, 2024
1 parent dd38be9 commit 3cdc1c4
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 74 deletions.
65 changes: 0 additions & 65 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"test:build": "jest --clearCache && jest --collectCoverage"
},
"peerDependencies": {
"@babel/eslint-parser": "^7.25.9",
"@smarttools/eslint-plugin-rxjs": "^1.0.11",
"@stylistic/eslint-plugin": "^2.12.1",
"@stylistic/eslint-plugin-js": "^2.12.1",
Expand Down Expand Up @@ -78,7 +77,6 @@
},
"devDependencies": {
"@asciidoctor/gulp-asciidoctor": "^2.2.5",
"@babel/eslint-parser": "^7.25.9",
"@jest/globals": "~29.7.0",
"@perfective/build": "~0.15.1",
"@smarttools/eslint-plugin-rxjs": "1.0.11",
Expand Down
9 changes: 2 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// eslint-disable-next-line import/no-extraneous-dependencies -- ESLint parser used only during development
import * as tsEslint from 'typescript-eslint';

// eslint-disable-next-line import/no-extraneous-dependencies -- ESLint parser used only during development
import * as babelParser from '@babel/eslint-parser';

// eslint-disable-next-line unicorn/prevent-abbreviations -- matches plugin name
import { arrayFuncConfig } from './rules/array-func';
import { eslintConfig } from './rules/eslint';
Expand Down Expand Up @@ -82,15 +79,13 @@ export default [
{
files: ['**/*.js?(x)'],
languageOptions: {
parser: babelParser,
sourceType: 'module',
ecmaVersion: 'latest',
parserOptions: {
ecmaVersion: 6,
ecmaFeatures: {
globalReturn: false,
impliedStrict: true,
},
sourceType: 'module',
requireConfigFile: false,
},
},
plugins: {},
Expand Down

0 comments on commit 3cdc1c4

Please sign in to comment.