> For the complete documentation index, see [llms.txt](https://notes.lirenxn.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://notes.lirenxn.com/featured/deep-dive-eslint.md).

# Deep dive eslint

### Lessons I learned from debugging eslint issues

1. [**eslint** with class property -- How **babel-eslint** work with **eslint**](/featured/deep-dive-eslint/eslint-with-class-property.md)&#x20;
2. [**eslint** with **fix** -- pitfall with `CLIEngine()`](/featured/deep-dive-eslint/eslint-with-fix.md)
3. [**eslint** with **jsx**](/featured/deep-dive-eslint/eslint-with-jsx.md)

### Tips:

#### eslint and babel-loader

**babel-eslint <= v10.x** parses the code with a set of default opts, **without** being able to access the project's `.babalrc` config file.

Tricky part is, its github default page for `babel-eslint` is actually for **UNRELEASED v11.x**, in which a new config field `parserOption.babelOptions` is added. With `babel` changed to a peerDep and external parse config.

> This ensures that the same Babel configuration is used during both linting and compilation.

```javascript
"parserOptions":{
  "babelOptions":{
    "configFile": "PATH_TO_CONFIG"
  }
}
```

#### Programmatically linting (in custom cli)

`eslint` have a `CliEngine` which loads the cli options. `--print-config` will trigger `engine.getConfigForFile(PATH_TO_SINGLE_FILE)` to load the config for single file. Cos the config can vary for different type of files, you need to specify single file here.

**vscode eslint extension**

> **The extension uses the ESLint library installed in the opened workspace folder. If the folder doesn't provide one the extension looks for a global install version.**


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://notes.lirenxn.com/featured/deep-dive-eslint.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
