eslint / eslint/js

Proposal: errors option

Open
#368 7 comments 3 reactions 1 assignee Claimed by @nzakas View on GitHub
accepted enhancement
Dominant language
JavaScript
Stars
2.4k
Forks
234
Avg merge
28m
Merged PRs (30d)
2

Description

**Purpose:** There are recoverable errors in syntax error, e.g. duplicate names, invalid escapes in RegExp, and etc. ESLint stops all linting if it encountered those recoverable errors. However, ESLint should be able to work.

**Proposal:** Adds `errors` option to espree.

```js
const ast = espree.parse(code, { errors: true })
console.log(ast.errors) //→ Array of recoverable errors.
```

`acorn` reports errors by `this.raiseRecoverable()` method if the error is recoverable. If the `errors:true` option is given, espree collects recoverable errors into `ast.errors` property instead of throwing exception.

Then ESLint can report the `ast.errors` to users.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.