import-js / import-js/eslint-plugin-import

use ESLint config to determine parse options

Open
#448 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
5.9k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

https://github.com/eslint/eslint/blob/master/lib/config.js

Instead of relying fully on [UAJSG] to determine parsing goal, could also use ESLint config to get a parse goal.

If a file is marked `sourceType: module` by ESLint config, it will be assumed to be a module without disambiguation.

If it is marked `script`, disambiguation must be used as this should default to `script` for files outside ESLint's purview (i.e. `node_modules`, etc.) and thus can't be considered an _explicit_ parse goal.

For packages including `jsnext:main`, this is also ideal as the other parse options (parser, `experimentalObjectRestSpread`, `jsx`, etc.) can be leveraged from their (hopefully included and existing) `.eslintrc.*`.

Contributor guide

Open the contributing guide

Research direction

Start with lib/config.js and trace how UAJSG currently determines parsing goals. Review how ESLint configuration exposes sourceType and parser options, including .eslintrc.* files. Done means configured modules avoid disambiguation, configured scripts retain it, and applicable parser options are honored.

Written by the indexing model from the issue text.

Assessment

Tech stack
eslint, javascript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.