main ccdfa911cfce cached
112 files
103.0 KB
29.8k tokens
82 symbols
1 requests
Download .txt
Repository: webpack-contrib/eslint-webpack-plugin
Branch: main
Commit: ccdfa911cfce
Files: 112
Total size: 103.0 KB

Directory structure:
gitextract_ibjnkmu0/

├── .cspell.json
├── .editorconfig
├── .gitattributes
├── .github/
│   └── workflows/
│       ├── dependency-review.yml
│       └── nodejs.yml
├── .gitignore
├── .prettierignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── babel.config.js
├── commitlint.config.js
├── eslint.config.mjs
├── husky.config.js
├── jest.config.js
├── lint-staged.config.js
├── package.json
├── src/
│   ├── ESLintError.js
│   ├── getESLint.js
│   ├── index.js
│   ├── linter.js
│   ├── options.js
│   ├── options.json
│   └── utils.js
├── test/
│   ├── .badeslintrc
│   ├── autofix-stop.test.js
│   ├── autofix.test.js
│   ├── cached.test.js
│   ├── child-compiler.test.js
│   ├── circular-plugin.test.js
│   ├── config-for-tests/
│   │   ├── .eslintrc.js
│   │   └── eslint.config.mjs
│   ├── context.test.js
│   ├── emit-error.test.js
│   ├── emit-warning.test.js
│   ├── empty.test.js
│   ├── error.test.js
│   ├── eslint-lint.test.js
│   ├── eslint-options.test.js
│   ├── eslint-path.test.js
│   ├── eslintrc-config.test.js
│   ├── exclude.test.js
│   ├── fail-on-config.test.js
│   ├── fail-on-error.test.js
│   ├── fail-on-warning.test.js
│   ├── fixtures/
│   │   ├── [symbols]/
│   │   │   ├── error.js
│   │   │   └── symbols-entry.js
│   │   ├── cache.js
│   │   ├── child-entry.js
│   │   ├── error-entry.js
│   │   ├── error-warn-entry.js
│   │   ├── error.js
│   │   ├── eslintrc-config.js
│   │   ├── exclude-entry.js
│   │   ├── exclude-folder-entry.js
│   │   ├── fixable-clone-entry.js
│   │   ├── fixable.js
│   │   ├── flat-config.js
│   │   ├── folder/
│   │   │   ├── error.js
│   │   │   └── readme.md
│   │   ├── full-of-problems-entry.js
│   │   ├── full-of-problems.js
│   │   ├── good-entry.js
│   │   ├── good.js
│   │   ├── ignore-entry.js
│   │   ├── ignore.js
│   │   ├── index.js
│   │   ├── lint-more-entry.js
│   │   ├── lint-more.js
│   │   ├── lint-one-entry.js
│   │   ├── lint-two-entry.js
│   │   ├── lint.js
│   │   ├── media/
│   │   │   └── some-video.ts
│   │   ├── multiple-entry.js
│   │   ├── nonfixable-clone-entry.js
│   │   ├── nonfixable.js
│   │   ├── query-entry.js
│   │   ├── require.js
│   │   ├── resource-query-entry.js
│   │   ├── warn-entry.js
│   │   ├── warn-error-entry.js
│   │   └── warn.js
│   ├── flat-config.test.js
│   ├── formatter-custom.test.js
│   ├── formatter-eslint.test.js
│   ├── formatter-official.test.js
│   ├── formatter-write.test.js
│   ├── ignore.test.js
│   ├── lint-dirty-modules-only.test.js
│   ├── mock/
│   │   ├── eslint/
│   │   │   ├── index.js
│   │   │   └── package.json
│   │   └── formatter/
│   │       └── index.js
│   ├── multiple-instances.test.js
│   ├── ok.test.js
│   ├── parameters.test.js
│   ├── query.test.js
│   ├── quiet.test.js
│   ├── resource-query.test.js
│   ├── symbols.test.js
│   ├── threads.test.js
│   ├── utils/
│   │   ├── conf.js
│   │   └── pack.js
│   ├── utils.test.js
│   ├── warning.test.js
│   └── watch.test.js
├── tsconfig.json
└── types/
    ├── ESLintError.d.ts
    ├── getESLint.d.ts
    ├── index.d.ts
    ├── linter.d.ts
    ├── options.d.ts
    └── utils.d.ts

================================================
FILE CONTENTS
================================================

================================================
FILE: .cspell.json
================================================
{
  "version": "0.2",
  "language": "en,en-gb",
  "words": [
    "arrify",
    "notjs",
    "nonfixable",
    "dasdas",
    "badeslintrc",
    "autofix",
    "autofixing",
    "checkstyle",
    "commitlint",
    "indentifiers"
  ],

  "ignorePaths": [
    "CHANGELOG.md",
    "package.json",
    "coverage",
    "/test/outputs",
    "dist/**",
    "**/__snapshots__/**",
    "package-lock.json",
    "node_modules",
    "coverage",
    "*.log"
  ]
}


================================================
FILE: .editorconfig
================================================
# editorconfig.org

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false


================================================
FILE: .gitattributes
================================================
* text=auto
bin/* eol=lf
package-lock.json -diff
yarn.lock -diff


================================================
FILE: .github/workflows/dependency-review.yml
================================================
name: "Dependency Review"
on: [pull_request]

permissions:
  contents: read

jobs:
  dependency-review:
    runs-on: ubuntu-latest
    steps:
      - name: "Checkout Repository"
        uses: actions/checkout@v6
      - name: "Dependency Review"
        uses: actions/dependency-review-action@v4


================================================
FILE: .github/workflows/nodejs.yml
================================================
name: eslint-webpack-plugin

on:
  push:
    branches:
      - main
      - next
  pull_request:
    branches:
      - main
      - next

permissions:
  contents: read

jobs:
  lint:
    name: Lint - ${{ matrix.os }} - Node v${{ matrix.node-version }}

    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

    strategy:
      matrix:
        os: [ubuntu-latest]
        node-version: [lts/*]

    runs-on: ${{ matrix.os }}

    concurrency:
      group: lint-${{ matrix.os }}-v${{ matrix.node-version }}-${{ github.ref }}
      cancel-in-progress: true

    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 0

      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v6
        with:
          node-version: ${{ matrix.node-version }}

      - name: Install dependencies
        run: npm ci

      - name: Lint
        run: npm run lint

      - name: Security audit
        run: npm run security

      - name: Validate PR commits with commitlint
        if: github.event_name == 'pull_request'
        run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose

  test:
    name: Test - ${{ matrix.os }} - Node v${{ matrix.node-version }}, Webpack ${{ matrix.webpack-version }}, Eslint ${{ matrix.eslint-version }}

    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
        node-version: [20.x, 22.x, 24.x]
        eslint-version: [9.x, 10.x]
        webpack-version: [latest]

    runs-on: ${{ matrix.os }}

    concurrency:
      group: test-${{ matrix.os }}-v${{ matrix.node-version }}-${{ matrix.eslint-version }}-${{ matrix.webpack-version }}-${{ github.ref }}
      cancel-in-progress: true

    steps:
      - uses: actions/checkout@v6

      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v6
        with:
          node-version: ${{ matrix.node-version }}
          cache: "npm"

      - name: Install dependencies
        run: npm ci

      - name: Install webpack ${{ matrix.webpack-version }}
        run: npm i webpack@${{ matrix.webpack-version }}

      - name: Install eslint ${{ matrix.eslint-version }}
        run: npm i eslint@${{ matrix.eslint-version }}

      - name: Run tests for webpack version ${{ matrix.webpack-version }}
        run: npm run test:coverage -- --ci

      - name: Submit coverage data to codecov
        uses: codecov/codecov-action@v6
        with:
          token: ${{ secrets.CODECOV_TOKEN }}


================================================
FILE: .gitignore
================================================
logs
*.log
npm-debug.log*
yarn-debug.log*
.eslintcache

/coverage
/dist
/local
/reports
/node_modules
/test/outputs

.DS_Store
Thumbs.db
.idea
.vscode
*.sublime-project
*.sublime-workspace
*.iml


================================================
FILE: .prettierignore
================================================
/coverage
/dist
/node_modules
/test/fixtures
/test/outputs
CHANGELOG.md


================================================
FILE: CHANGELOG.md
================================================
# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [6.0.0](https://github.com/webpack/eslint-webpack-plugin/compare/v5.0.3...v6.0.0) (2026-04-03)


### ⚠ BREAKING CHANGES

* remove threads option (#299)
* use `compiler.options.mode` to set the default value of `failOnError` (#296)
* add support for ESLint v10 and remove support for ESLint v8 and Node.js v18 (#295)

### Features

* add support for ESLint v10 and remove support for ESLint v8 and Node.js v18 ([#295](https://github.com/webpack/eslint-webpack-plugin/issues/295)) ([42de4fe](https://github.com/webpack/eslint-webpack-plugin/commit/42de4fefc67d0d3983a14c73a70d93f497735e73))


### Bug Fixes

* do not store errors, errors from files not included should not be reported ([#298](https://github.com/webpack/eslint-webpack-plugin/issues/298)) ([a4400b2](https://github.com/webpack/eslint-webpack-plugin/commit/a4400b2396b179bb8b15ee2a1b159a106d7c962a))
* use `compiler.options.mode` to set the default value of `failOnError` ([#296](https://github.com/webpack/eslint-webpack-plugin/issues/296)) ([def99b0](https://github.com/webpack/eslint-webpack-plugin/commit/def99b0c1d72c8d6b70361f0b2215ff2dc3ead59))


* remove threads option ([#299](https://github.com/webpack/eslint-webpack-plugin/issues/299)) ([a53360e](https://github.com/webpack/eslint-webpack-plugin/commit/a53360e1291ea08307d21efa7102d6a7c9725f42))

### [5.0.3](https://github.com/webpack/eslint-webpack-plugin/compare/v5.0.2...v5.0.3) (2026-02-27)


### Bug Fixes

* display errors and warnings ([#297](https://github.com/webpack/eslint-webpack-plugin/issues/297)) ([d099b5d](https://github.com/webpack/eslint-webpack-plugin/commit/d099b5dd504ce074ed481eff37c1ebec4f3ec288))

### [5.0.2](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v5.0.1...v5.0.2) (2025-06-09)


### Bug Fixes

* don't error on circular eslint plugins ([#277](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/277)) ([32f05c6](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/32f05c6fdd70ec5532682ce5ed134998a269cdf3))

### [5.0.1](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v5.0.0...v5.0.1) (2025-04-15)


### Bug Fixes

* fail on error and fail on warning ([#275](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/275)) ([4ef97cd](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/4ef97cd46b5ced43d5a68444bce2d392ddd28166))

## [5.0.0](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v4.2.0...v5.0.0) (2025-02-26)


### ⚠ BREAKING CHANGES

* Use flat config by default
* Minimum supported Node.js version is 18.12.0

## [4.2.0](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v4.1.0...v4.2.0) (2024-05-24)


### Features

* support eslint 9 ([#250](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/250)) ([d25e94c](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/d25e94c90b477d465bf4d7fb6450a9b4ed6936f4))


### Bug Fixes

* use `stillValidModule` only `lintDirtyModulesOnly` is disabled ([#253](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/253)) ([b52d1e7](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/b52d1e743e77e657256919ca7b0cdb1d432a1fb9))

## [4.1.0](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v4.0.0...v4.1.0) (2024-03-14)


### Features

* support flat config ([#238](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/238)) ([19cadbe](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/19cadbe3117fa7899eba2424d7bb07bc403160c5))

### [4.0.1](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v4.0.0...v4.0.1) (2023-04-10)


### Performance

* enable `cache` by default ([#213](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/213))

## [4.0.0](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v3.2.0...v4.0.0) (2023-02-03)


### ⚠ BREAKING CHANGES

* drop node v12 and eslint v7 (#159)

### Bug Fixes

* lint modules that are cached with webpack's filesystem cache ([#197](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/197)) ([92f25ec](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/92f25ecf5f92d72bab4c80dac363a1c632e3500f)), closes [#130](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/130)


* drop node v12 and eslint v7 ([#159](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/159)) ([1edd3c1](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/1edd3c1ab63ba864768d812401ce500318548e2d))

## [3.2.0](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v3.1.1...v3.2.0) (2022-06-23)


### Features

* add eslint prefix to CLI output for better debugging ([#155](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/155)) ([67efb34](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/67efb34fc2ad11dcd6593fce21059aea271dcfc7))
* removed cjs wrapper ([#152](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/152)) ([125becf](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/125becfaad348042b732d074b346bb3243dd7fa4))
* support resourceQueryExclude option ([#165](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/165)) ([464120f](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/464120fa74f0f0ccca98322ef43a4c057528a964))

### [3.1.1](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v3.1.0...v3.1.1) (2021-11-11)


### Bug Fixes

* child compiler lint ([#127](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/127)) ([18d5f23](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/18d5f23ecefd1a242f62722e8487ef2bcc39bc8c))

## [3.1.0](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v3.0.1...v3.1.0) (2021-10-27)


### Features

* support eslint 8 ([#121](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/121)) ([caeb2dd](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/caeb2dd198ea4261091650e62cb30d2a54530f1d))

### [3.0.1](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v3.0.0...v3.0.1) (2021-07-20)


### Bug Fixes

* crash with `ERR_REQUIRE_ESM` error ([26b4db3](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/26b4db37f1b39d597c26fbab52374425e2c455ac))

## [3.0.0](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v2.5.4...v3.0.0) (2021-07-19)


### ⚠ BREAKING CHANGES

* webpack v4 and nodejs v10 dropped (#105)

* webpack v4 and nodejs v10 dropped ([#105](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/105)) ([594d84c](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/594d84cc800057f889b23a27e9bc31e2eb5e32f1))

### [2.5.4](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v2.5.3...v2.5.4) (2021-04-19)


### Bug Fixes

* context with symbols ([#94](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/94)) ([6fc6874](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/6fc6874f4ee295eea372dcfa0a86799b355dab70))
* resolve paths and normalize ([#97](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/97)) ([818b825](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/818b825db119dde0b53b24d96688f1af89344b29))
* use `finishModules` if thread is less than or equal 1 ([#95](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/95)) ([c12e7be](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/c12e7be0be49f95fa8f2d9ae354acba3bd412b5c))

### [2.5.3](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v2.5.2...v2.5.3) (2021-03-24)


### Bug Fixes

* allow multiple instances ([#92](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/92)) ([0cdd621](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/0cdd621be597c643cad6c4a41c7fed31c29fb1a5))
* match hidden directories for path exclusions ([#87](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/87)) ([bb8750c](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/bb8750cb8a1cb4f6297a07b579ad4e394e11d968))

### [2.5.2](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v2.5.1...v2.5.2) (2021-02-18)


### Bug Fixes

* **fail-on-error:** show eslint errors when failOnError is disabled ([#85](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/85)) ([69be533](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/69be5338a8f72ffdbee055ab926cf4d84047fd35))

### [2.5.1](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v2.5.0...v2.5.1) (2021-02-12)


### Bug Fixes

* exclude node_modules root ([#80](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/80)) ([be0391e](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/be0391e28322e220cf628f842f35b3d800c284c0))
* prevent lint all files ([#77](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/77)) ([f57cb8e](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/f57cb8e1f01c522e562f0af3460d900d7fbba94f))
* update types ([#81](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/81)) ([90608da](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/90608da93f13ae2de70c2696d4284c1558a3f301))

## [2.5.0](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v2.4.3...v2.5.0) (2021-02-04)


### Refactor

* Updates to emitError and emitWarning

Setting only emitError to true will no longer exclusively print files with errors
and disregard the files with warnings. Similarly, setting only emitWarning to true
will no longer exclusively print files with warnings disregard the files with errors.

* fix: use quiet to override emitError and emitWarning

- quiet is essentially syntactic sugar for setting emitError to true
and emitWarning to false

### Bug Fixes

* fails when `failOnError` or `failOnWarning` enabled ([#72](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/72)) ([8a72a8a](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/8a72a8ad26b8decb800f955d8f4d362f280c4d0f))
* lint dirty modules only ([#67](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/67)) ([f7f372e](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/f7f372e800e75fcd2928655648fee01266c6d158))
* threads multi-compiler ([#69](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/69)) ([cef4f74](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/cef4f7473707fb3f069ec44c54b5ed2d27d931f8))
* types ([#66](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/66)) ([4daddf5](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/4daddf5335b2c78203482d7e7f6d82a909277212))
* Fix emit warning error quiet (#46) ([d38165b](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/d38165bef1e2d73a9d53f42d80b926c9eab12707)), closes [#46](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/46) [#19](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/19) [#19](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/19)

### [2.4.3](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v2.4.2...v2.4.3) (2021-01-19)


### Bug Fixes

* crash on `split` ([#62](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/62)) ([db38f61](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/db38f611965cfdec83984364e0b982bbd7a678e0))

### [2.4.2](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v2.4.1...v2.4.2) (2021-01-19)


### Bug Fixes

* strip resource query ([#58](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/58)) ([f0a2d81](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/f0a2d81a4feecf87e13649f2930f773c04fa3814))

### [2.4.1](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v2.4.0...v2.4.1) (2020-11-30)


### Bug Fixes

* [#43](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/43), [#44](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/44), [#45](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/45) ([#47](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/47)) ([4b8d4de](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/4b8d4def970381126f70c8407eb708c1c975bbf5))
* recompile speedups ([#55](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/55)) ([d862d92](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/d862d9291853c6b7430a0dbdc965b16db0723925))

## [2.4.0](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v2.3.0...v2.4.0) (2020-11-20)


### Features

* threads ([#39](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/39)) ([1e38fc7](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/1e38fc77fd575d9e56be0da6a206ded54a8f7c34))

## [2.3.0](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v2.2.1...v2.3.0) (2020-11-13)


### Features

* exclude option ([#41](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/41)) ([dc2fac7](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/dc2fac7918c0733f26fa5a1683315bf439370559))

### [2.2.1](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v2.2.0...v2.2.1) (2020-11-07)


### Bug Fixes

* folder pattern ([#36](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/36)) ([e79741e](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/e79741ee22d04c8c6e4d6f11d6869434ed5b339d))

## [2.2.0](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v1.0.0...v2.2.0) (2020-11-04)


### Features

* feat: only use the import graph, update tests ([#28](https://github.com/webpack-contrib/eslint-webpack-plugin/pull/28)) ([47612f16](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/47612f16894f22f4b5c3848595bba48ca8eb9b0f))

### Bug Fixes

* fix: use compiler.outputFileSystem to write report

* fix: use fs callback forms because webpack5 does not work with promisify on outputFileSystem methods

* fix: do not accumulate more taps as watchRuns occur

* fix: windows path escape, cleanup watch-fixture

## [2.1.0](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v1.0.0...v2.1.0) (2020-07-30)


### Features

* support typescript ([#8](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/8)) ([6634d96](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/6634d96e7e80dd2d7097479f13a48115e0544f59))

## [2.0.0](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v1.0.0...v2.0.0) (2020-07-26)


### Features

* ESLint class migration ([#11](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/11)) ([efd5e7d](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/efd5e7d01b8569c5dcb2808f618f56e4857fcf52)), closes [#10](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/10) [#10](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/10) [#10](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/10) [#10](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/10) [#10](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/10) [#10](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/10) [#10](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/10) [#10](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/10) [#10](https://github.com/webpack-contrib/eslint-webpack-plugin/issues/10)

### ⚠ BREAKING CHANGES

* minimum supported eslint version is `7`

## [1.0.0](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v0.1.0...v1.0.0) (2020-05-04)

### ⚠ BREAKING CHANGES

* minimum supported Node.js version is `10.13`
* minimum supported eslint version is `6.0.0`

## [0.1.0](https://github.com/webpack-contrib/eslint-webpack-plugin/compare/v0.0.1...v0.1.0) (2019-12-20)


### Features

* support webpack 5 ([b7f3679](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/b7f3679a8d5e5166376caec2a28ed38d6772bcca))


### Bug Fixes

* hooks and callback error ([3e7c36e](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/3e7c36e78e7c05bb5559adced2f92317affbf1ff))
* resolve file glob patterns ([d5c8820](https://github.com/webpack-contrib/eslint-webpack-plugin/commit/d5c8820d9467e8794a4aa3944bf6ded746d79411))

### 0.0.1 (2019-11-12)


================================================
FILE: LICENSE
================================================
Copyright JS Foundation and other contributors

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


================================================
FILE: README.md
================================================
<div align="center">
  <a href="https://github.com/eslint/eslint"><img width="200" height="200" src="https://cdn.worldvectorlogo.com/logos/eslint.svg"></a>
  <a href="https://github.com/webpack/webpack"><img width="200" height="200" src="https://webpack.js.org/assets/icon-square-big.svg"></a>
</div>

[![npm][npm]][npm-url]
[![node][node]][node-url]
[![tests][tests]][tests-url]
[![coverage][cover]][cover-url]
[![discussion][discussion]][discussion-url]
[![size][size]][size-url]

# eslint-webpack-plugin

> This version of eslint-webpack-plugin only supports webpack 5. For the webpack 4, see the [2.x branch](https://github.com/webpack/eslint-webpack-plugin/tree/2.x).

This plugin uses [`ESlint`](https://eslint.org/) to find and fix problems in your JavaScript code during the Webpack build process.

## Getting Started

To begin, you'll need to install `eslint-webpack-plugin`:

```console
npm install eslint-webpack-plugin --save-dev
```

or

```console
yarn add -D eslint-webpack-plugin
```

or

```console
pnpm add -D eslint-webpack-plugin
```

> [!NOTE]
>
> You also need to install `eslint >= 9` from npm, if you haven't already:

```console
npm install eslint --save-dev
```

or

```console
yarn add -D eslint
```

or

```console
pnpm add -D eslint
```

Then add the plugin to your webpack configuration. For example:

```js
const ESLintPlugin = require("eslint-webpack-plugin");

module.exports = {
  // ...
  plugins: [new ESLintPlugin(options)],
  // ...
};
```

## Options

You can pass [ESLint Node.js API options](https://eslint.org/docs/latest/integrate/nodejs-api#-new-eslintoptions).

> [!NOTE]
>
> The config option you provide will be passed to the `ESLint` class.
> See the [ESlint docs](https://eslint.org/docs/latest/integrate/nodejs-api#-new-eslintoptions) for more details.

### `cache`

- Type:

```ts
type cache = boolean;
```

- Default: `true`

The cache is enabled by default to decrease execution time.

### `cacheLocation`

- Type:

```ts
type cacheLocation = string;
```

- Default: `node_modules/.cache/eslint-webpack-plugin/.eslintcache`

Specify the path to the cache location. Can be a file or a directory.

### `configType`

- Type:

```ts
type configType = "flat" | "eslintrc";
```

- Default: `flat`

Specify the type of configuration to use with ESLint.

- `flat` is the current standard configuration format.
- `eslintrc` is the legacy configuration format and has been officially deprecated.

The new configuration format is explained in its [own documentation](https://eslint.org/docs/latest/use/configure/configuration-files).

### `context`

- Type:

```ts
type context = string;
```

- Default: `compiler.context`

Base directory for linting.

### `eslintPath`

- Type:

```ts
type eslintPath = string;
```

- Default: `eslint`

Path to `eslint` instance that will be used for linting.

If the `eslintPath` is a folder like a official ESlint, or specify a `formatter` option, now you don't have to install `eslint`.

### `extensions`

- Type:

```ts
type extensions = string | string[];
```

- Default: `'js'`

Specify file extensions that should be checked.

### `exclude`

- Type:

```ts
type exclude = string | string[];
```

- Default: `'node_modules'`

Specify the files/directories to exclude. Must be relative to `options.context`.

### `resourceQueryExclude`

- Type:

```ts
type resourceQueryExclude = RegExp | RegExp[];
```

- Default: `[]`

Specify the resource query to exclude.

### `files`

- Type:

```ts
type files = string | string[];
```

- Default: `null`

Specify directories, files, or globs. Must be relative to `options.context`.
Directories are traversed recursively looking for files matching `options.extensions`.
File and glob patterns ignore `options.extensions`.

### `fix`

- Type:

```ts
type fix = boolean;
```

- Default: `false`

Will enable [ESLint autofix feature](https://eslint.org/docs/latest/integrate/nodejs-api#-eslintoutputfixesresults).

**Be careful: this option will modify source files.**

### `formatter`

- Type:

```ts
type formatter =
  | string
  | ((
      results: import("eslint").ESLint.LintResult[],
      data?: import("eslint").ESLint.LintResultData | undefined,
    ) => string);
```

- Default: `'stylish'`

Accepts a function that receives an array of ESLint messages (object) as its argument and must return a string as output.

You can use official [ESlint formatters](https://eslint.org/docs/user-guide/formatters/).

### `lintDirtyModulesOnly`

- Type:

```ts
type lintDirtyModulesOnly = boolean;
```

- Default: `false`

Lint only changed files, skipping initial lint on build start.

### Errors and Warning

**By default the plugin will auto adjust error reporting depending on eslint errors/warnings counts.**

You can still force this behavior by using `emitError` **or** `emitWarning` options:

#### `emitError`

- Type:

```ts
type emitError = boolean;
```

- Default: `true`

The errors found will always be emitted, to disable set to `false`.

#### `emitWarning`

- Type:

```ts
type emitWarning = boolean;
```

- Default: `true`

The warnings found will always be emitted, to disable set to `false`.

#### `failOnError`

- Type:

```ts
type failOnError = boolean;
```

- Default: `true`

Will cause the module build to fail if any errors are found, to disable set to `false`.

#### `failOnWarning`

- Type:

```ts
type failOnWarning = boolean;
```

- Default: `false`

Will cause the module build to fail if any warnings are found, if set to `true`.

#### `quiet`

- Type:

```ts
type quiet = boolean;
```

- Default: `false`

Will process and report errors only and ignore warnings, if set to `true`.

#### `outputReport`

- Type:

```ts
type outputReport =
  | boolean
  | {
      filePath?: string | undefined;
      formatter?:
        | (
            | string
            | ((
                results: import("eslint").ESLint.LintResult[],
                data?: import("eslint").ESLint.LintResultData | undefined,
              ) => string)
          )
        | undefined;
    };
```

- Default: `false`

Write ESLint results to a file, for example a checkstyle xml file for use for reporting on Jenkins CI.

- filePath: Path to output report file (relative to output.path or absolute).
- formatter: You can pass in a different `formatter` for the output file.
  if none is passed in the default/configured formatter will be used.

## Changelog

[Changelog](CHANGELOG.md)

## Contributing

We welcome all contributions!

If you're new here, please take a moment to review our contributing guidelines.

[CONTRIBUTING](https://github.com/webpack/eslint-webpack-plugin?tab=contributing-ov-file#contributing)

## License

[MIT](./LICENSE)

[npm]: https://img.shields.io/npm/v/eslint-webpack-plugin.svg
[npm-url]: https://npmjs.com/package/eslint-webpack-plugin
[node]: https://img.shields.io/node/v/eslint-webpack-plugin.svg
[node-url]: https://nodejs.org
[tests]: https://github.com/webpack/eslint-webpack-plugin/workflows/eslint-webpack-plugin/badge.svg
[tests-url]: https://github.com/webpack/eslint-webpack-plugin/actions
[cover]: https://codecov.io/gh/webpack/eslint-webpack-plugin/branch/main/graph/badge.svg
[cover-url]: https://codecov.io/gh/webpack/eslint-webpack-plugin
[discussion]: https://img.shields.io/github/discussions/webpack/webpack
[discussion-url]: https://github.com/webpack/webpack/discussions
[size]: https://packagephobia.now.sh/badge?p=eslint-webpack-plugin
[size-url]: https://packagephobia.now.sh/result?p=eslint-webpack-plugin


================================================
FILE: babel.config.js
================================================
const MIN_BABEL_VERSION = 7;

module.exports = (api) => {
  api.assertVersion(MIN_BABEL_VERSION);
  api.cache(true);

  return {
    presets: [
      [
        "@babel/preset-env",
        {
          targets: {
            node: "14.15.0",
          },
        },
      ],
    ],
  };
};


================================================
FILE: commitlint.config.js
================================================
module.exports = {
  extends: ["@commitlint/config-conventional"],
  rules: {
    "header-max-length": [0],
    "body-max-line-length": [0],
    "footer-max-line-length": [0],
  },
};


================================================
FILE: eslint.config.mjs
================================================
import { defineConfig } from "eslint/config";
import configs from "eslint-config-webpack/configs.js";

export default defineConfig([
  {
    extends: [configs["recommended-dirty"]],
  },
]);


================================================
FILE: husky.config.js
================================================
module.exports = {
  hooks: {
    "pre-commit": "lint-staged",
    "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
  },
};


================================================
FILE: jest.config.js
================================================
module.exports = {
  collectCoverage: true,
  collectCoverageFrom: ["src/**/*"],
  testEnvironment: "node",
  testTimeout: 60000,
  transformIgnorePatterns: ["node_modules/(?!(arrify)/)"],
};


================================================
FILE: lint-staged.config.js
================================================
module.exports = {
  "*.js": ["eslint --fix", "prettier --write", "cspell"],
  "*.{json,md,yml,css,ts}": ["prettier --write"],
};


================================================
FILE: package.json
================================================
{
  "name": "eslint-webpack-plugin",
  "version": "6.0.0",
  "description": "A ESLint plugin for webpack",
  "keywords": [
    "eslint",
    "lint",
    "linter",
    "plugin",
    "webpack"
  ],
  "homepage": "https://github.com/webpack/eslint-webpack-plugin",
  "bugs": "https://github.com/webpack/eslint-webpack-plugin/issues",
  "repository": "webpack/eslint-webpack-plugin",
  "funding": {
    "type": "opencollective",
    "url": "https://opencollective.com/webpack"
  },
  "license": "MIT",
  "author": "Ricardo Gobbo de Souza <ricardogobbosouza@yahoo.com.br>",
  "main": "dist/index.js",
  "types": "types/index.d.ts",
  "files": [
    "dist",
    "types"
  ],
  "scripts": {
    "start": "npm run build -- -w",
    "clean": "del-cli dist types",
    "prebuild": "npm run clean",
    "build:types": "tsc --declaration --emitDeclarationOnly --outDir types && prettier \"types/**/*.ts\" --write",
    "build:code": "cross-env NODE_ENV=production babel src -d dist --copy-files",
    "build": "npm-run-all -p \"build:**\"",
    "commitlint": "commitlint --from=main",
    "security": "npm audit --omit=dev",
    "lint:prettier": "prettier -w --list-different .",
    "lint:code": "eslint --cache .",
    "lint:spelling": "cspell \"**/*.*\"",
    "lint:types": "tsc --pretty --noEmit",
    "lint": "npm-run-all -l -p \"lint:**\"",
    "fix:code": "npm run lint:code -- --fix",
    "fix:prettier": "npm run lint:prettier -- --write",
    "fix": "npm-run-all -l fix:code fix:prettier",
    "test:only": "cross-env NODE_OPTIONS=--experimental-vm-modules NODE_ENV=test jest --testTimeout=60000",
    "test:watch": "npm run test:only -- --watch",
    "test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
    "pretest": "npm run lint",
    "test": "npm run test:coverage",
    "prepare": "npm run build",
    "release": "standard-version"
  },
  "dependencies": {
    "@types/eslint": "^9.6.1",
    "micromatch": "^4.0.8",
    "normalize-path": "^3.0.0",
    "schema-utils": "^4.3.3"
  },
  "devDependencies": {
    "@babel/cli": "^7.28.6",
    "@babel/core": "^7.29.0",
    "@babel/preset-env": "^7.29.2",
    "@commitlint/cli": "^20.5.0",
    "@commitlint/config-conventional": "^20.5.0",
    "@types/fs-extra": "^11.0.4",
    "@types/micromatch": "^4.0.10",
    "@types/node": "^25.5.0",
    "@types/normalize-path": "^3.0.2",
    "chokidar": "^5.0.0",
    "cross-env": "^10.1.0",
    "cspell": "^9.7.0",
    "del": "^8.0.1",
    "del-cli": "^7.0.0",
    "eslint": "^9.39.4",
    "eslint-config-webpack": "^4.9.4",
    "fs-extra": "^11.3.4",
    "globals": "^17.4.0",
    "husky": "^9.1.7",
    "jest": "^30.3.0",
    "lint-staged": "^16.4.0",
    "npm-run-all": "^4.1.5",
    "prettier": "^3.8.1",
    "standard-version": "^9.5.0",
    "typescript": "^5.9.3",
    "webpack": "^5.105.4"
  },
  "peerDependencies": {
    "eslint": "^9.0.0 || ^10.0.0",
    "webpack": "^5.0.0"
  },
  "engines": {
    "node": ">= 20.9.0"
  }
}


================================================
FILE: src/ESLintError.js
================================================
class ESLintError extends Error {
  /**
   * @param {string=} messages messages
   */
  constructor(messages) {
    super(`[eslint] ${messages}`);
    this.name = "ESLintError";
    this.stack = "";
  }
}

module.exports = ESLintError;


================================================
FILE: src/getESLint.js
================================================
const { getESLintOptions } = require("./options");

/** @typedef {import("eslint").ESLint} ESLint */
/** @typedef {import("eslint").ESLint.LintResult} LintResult */
/** @typedef {import("./options").Options} Options */
/** @typedef {(files: string | string[]) => Promise<LintResult[]>} LintTask */
/** @typedef {{ eslint: ESLint, lintFiles: LintTask }} Linter */
/** @typedef {import("eslint").ESLint.Options} ESLintOptions */
/** @typedef {{ new (arg0: ESLintOptions): ESLint, outputFixes: (arg0: LintResult[]) => Promise<void> }} ESLintClass */

/**
 * @param {Options} options options
 * @returns {Promise<Linter>} linter
 */
async function getESLint(options) {
  const eslintOptions = getESLintOptions(options);
  const fix = Boolean(eslintOptions && eslintOptions.fix);

  const eslintModule = require(options.eslintPath || "eslint");

  /** @type {ESLintClass} */
  const ESLint = await eslintModule.loadESLint({
    useFlatConfig: options.configType === "flat",
  });

  /** @type {ESLint} */
  const eslint = new ESLint(eslintOptions);

  /**
   * @param {string | string[]} files files
   * @returns {Promise<LintResult[]>} lint results
   */
  async function lintFiles(files) {
    /** @type {LintResult[]} */
    const result = await eslint.lintFiles(files);
    // if enabled, use eslint autofixing where possible
    if (fix) {
      await ESLint.outputFixes(result);
    }
    return result;
  }

  return {
    lintFiles,
    eslint,
  };
}

module.exports = {
  getESLint,
};


================================================
FILE: src/index.js
================================================
const { isAbsolute, join } = require("node:path");

const { isMatch } = require("micromatch");

const linter = require("./linter");
const { getOptions } = require("./options");
const { arrify, parseFiles, parseFoldersToGlobs } = require("./utils");

/** @typedef {import("webpack").Compiler} Compiler */
/** @typedef {import("webpack").Module} Module */
/** @typedef {import("webpack").NormalModule} NormalModule */
/** @typedef {import("./options").Options} Options */

const ESLINT_PLUGIN = "ESLintWebpackPlugin";
const DEFAULT_FOLDER_TO_EXCLUDE = "**/node_modules/**";

let compilerId = 0;

class ESLintWebpackPlugin {
  /**
   * @param {Options=} options options
   */
  constructor(options = {}) {
    this.key = ESLINT_PLUGIN;
    this.options = getOptions(options);
    this.run = this.run.bind(this);
  }

  /**
   * @param {Compiler} compiler compiler
   * @returns {void}
   */
  apply(compiler) {
    // Generate key for each compilation,
    // this differentiates one from the other when being cached.
    this.key = compiler.name || `${this.key}_${(compilerId += 1)}`;
    this.options.failOnError ??= compiler.options.mode !== "development";

    const excludedFiles = parseFiles(
      this.options.exclude || [],
      this.getContext(compiler),
    );
    const resourceQueries = arrify(this.options.resourceQueryExclude || []);
    const excludedResourceQueries = resourceQueries.map((item) =>
      item instanceof RegExp ? item : new RegExp(item),
    );

    const options = {
      ...this.options,
      exclude: excludedFiles,
      resourceQueryExclude: excludedResourceQueries,
      extensions: arrify(this.options.extensions),
      files: parseFiles(this.options.files || "", this.getContext(compiler)),
    };

    const foldersToExclude = this.options.exclude
      ? options.exclude
      : DEFAULT_FOLDER_TO_EXCLUDE;
    const exclude = parseFoldersToGlobs(foldersToExclude);
    const wanted = parseFoldersToGlobs(options.files, options.extensions);

    // If `lintDirtyModulesOnly` is disabled,
    // execute the linter on the build
    if (!this.options.lintDirtyModulesOnly) {
      compiler.hooks.run.tapPromise(this.key, (compiler) =>
        this.run(compiler, options, wanted, exclude),
      );
    }

    let hasCompilerRunByDirtyModule = this.options.lintDirtyModulesOnly;

    compiler.hooks.watchRun.tapPromise(this.key, (compiler) => {
      if (!hasCompilerRunByDirtyModule) {
        return this.run(compiler, options, wanted, exclude);
      }

      hasCompilerRunByDirtyModule = false;

      return Promise.resolve();
    });
  }

  /**
   * @param {Compiler} compiler compiler
   * @param {Omit<Options, "resourceQueryExclude"> & { resourceQueryExclude: RegExp[] }} options options
   * @param {string[]} wanted wanted files
   * @param {string[]} exclude excluded files
   */
  async run(compiler, options, wanted, exclude) {
    // Do not re-hook
    const isCompilerHooked = compiler.hooks.compilation.taps.find(
      ({ name }) => name === this.key,
    );

    if (isCompilerHooked) return;

    compiler.hooks.compilation.tap(this.key, async (compilation) => {
      /** @type {import("./linter").Linter} */
      let lint;
      /** @type {import("./linter").Reporter} */
      let report;

      try {
        ({ lint, report } = await linter(options, compilation));
      } catch (err) {
        compilation.errors.push(err);
        return;
      }

      /** @type {string[]} */
      const files = [];

      /**
       * @param {Module} module module
       */
      function addFile(module) {
        const { resource } = /** @type {NormalModule} */ (module);

        if (!resource) return;

        const [file, query] = resource.split("?");
        const isFileNotListed = file && !files.includes(file);
        const isFileWanted =
          isMatch(file, wanted, { dot: true }) &&
          !isMatch(file, exclude, { dot: true });
        const isQueryNotExclude = options.resourceQueryExclude.every(
          (reg) => !reg.test(query),
        );

        if (isFileNotListed && isFileWanted && isQueryNotExclude) {
          files.push(file);
        }
      }

      // Add the file to be linted
      compilation.hooks.succeedModule.tap(this.key, addFile);

      if (!this.options.lintDirtyModulesOnly) {
        compilation.hooks.stillValidModule.tap(this.key, addFile);
      }

      // Lint all files added
      compilation.hooks.finishModules.tap(this.key, () => {
        if (files.length > 0) lint(files);
      });

      // await and interpret results
      compilation.hooks.processAssets.tapAsync(
        this.key,
        async (_, callback) => {
          const { errors, warnings, generateReportAsset } = await report();

          if (warnings) {
            compilation.warnings.push(warnings);
          }

          if (errors) {
            compilation.errors.push(errors);
          }

          if (generateReportAsset) {
            await generateReportAsset(compilation);
          }

          if (warnings && options.failOnWarning) {
            callback(warnings);
          } else if (errors && options.failOnError) {
            callback(errors);
          } else {
            callback();
          }
        },
      );
    });
  }

  /**
   * @param {Compiler} compiler compiler
   * @returns {string} context
   */
  getContext(compiler) {
    const compilerContext = String(compiler.options.context);
    const optionContext = this.options.context;

    if (!optionContext) return compilerContext;

    if (isAbsolute(optionContext)) return optionContext;

    return join(compilerContext, optionContext);
  }
}

module.exports = ESLintWebpackPlugin;


================================================
FILE: src/linter.js
================================================
const { dirname, isAbsolute, join } = require("node:path");

const ESLintError = require("./ESLintError");
const { getESLint } = require("./getESLint");

/** @typedef {import("eslint").ESLint} ESLint */
/** @typedef {import("eslint").ESLint.Formatter} Formatter */
/** @typedef {import("eslint").ESLint.LintResult} LintResult */
/** @typedef {import("webpack").Compiler} Compiler */
/** @typedef {import("webpack").Compilation} Compilation */
/** @typedef {import("./options").Options} Options */
/** @typedef {import("./options").FormatterFunction} FormatterFunction */
/** @typedef {(compilation: Compilation) => Promise<void>} GenerateReport */
/** @typedef {{ errors?: ESLintError, warnings?: ESLintError, generateReportAsset?: GenerateReport }} Report */
/** @typedef {() => Promise<Report>} Reporter */
/** @typedef {(files: string | string[]) => void} Linter */
/** @typedef {{ [files: string]: LintResult }} LintResultMap */

/**
 * @param {Promise<LintResult[]>[]} results results
 * @returns {Promise<LintResult[]>} flatted results
 */
async function flatten(results) {
  /**
   * @param {LintResult[]} acc acc
   * @param {LintResult[]} list list
   * @returns {LintResult[]} result
   */
  const flat = (acc, list) => [...acc, ...list];
  return (await Promise.all(results)).reduce(flat, []);
}

/**
 * @param {ESLint} eslint eslint
 * @param {LintResult[]} results results
 * @returns {Promise<LintResult[]>} result without warnings
 */
async function removeIgnoredWarnings(eslint, results) {
  const filterPromises = results.map(async (result) => {
    // Short circuit the call to isPathIgnored.
    //   fatal is false for ignored file warnings.
    //   ruleId is unset for internal ESLint errors.
    //   line is unset for warnings not involving file contents.
    const { messages, warningCount, errorCount, filePath } = result;
    const [firstMessage] = messages;
    const hasWarning = warningCount === 1 && errorCount === 0;
    const ignored =
      messages.length === 0 ||
      (hasWarning &&
        !firstMessage.fatal &&
        !firstMessage.ruleId &&
        !firstMessage.line &&
        (await eslint.isPathIgnored(filePath)));
    return ignored ? false : result;
  });

  return (await Promise.all(filterPromises)).filter(
    (result) => result !== false,
  );
}

/**
 * @param {ESLint} eslint eslint
 * @param {string | FormatterFunction=} formatter formatter
 * @returns {Promise<Formatter>} loaded formatter
 */
async function loadFormatter(eslint, formatter) {
  if (typeof formatter === "function") {
    return { format: formatter };
  }

  if (typeof formatter === "string") {
    try {
      return eslint.loadFormatter(formatter);
    } catch {
      // Load the default formatter.
    }
  }

  return eslint.loadFormatter();
}

/**
 * @param {Formatter} formatter formatter
 * @param {{ errors: LintResult[], warnings: LintResult[] }} results results
 * @returns {Promise<{ errors?: ESLintError, warnings?: ESLintError }>} errors and warnings
 */
async function formatResults(formatter, results) {
  let errors;
  let warnings;
  if (results.warnings.length > 0) {
    warnings = new ESLintError(await formatter.format(results.warnings));
  }

  if (results.errors.length > 0) {
    errors = new ESLintError(await formatter.format(results.errors));
  }

  return {
    errors,
    warnings,
  };
}

/**
 * @param {LintResult} file file
 * @returns {boolean} true when has errors, otherwise false
 */
function fileHasErrors(file) {
  return file.errorCount > 0;
}

/**
 * @param {LintResult} file file
 * @returns {boolean} true when has warnings, otherwise false
 */
function fileHasWarnings(file) {
  return file.warningCount > 0;
}

/**
 * @param {Options} options options results
 * @param {LintResult[]} results results
 * @returns {{ errors: LintResult[], warnings: LintResult[] }} parsed errors and warnings
 */
function parseResults(options, results) {
  /** @type {LintResult[]} */
  const errors = [];

  /** @type {LintResult[]} */
  const warnings = [];

  for (const file of results) {
    if (fileHasErrors(file)) {
      const messages = file.messages.filter(
        (message) => options.emitError && message.severity === 2,
      );

      if (messages.length > 0) {
        errors.push({ ...file, messages });
      }
    }

    if (fileHasWarnings(file)) {
      const messages = file.messages.filter(
        (message) => options.emitWarning && message.severity === 1,
      );

      if (messages.length > 0) {
        warnings.push({ ...file, messages });
      }
    }
  }

  return {
    errors,
    warnings,
  };
}

/**
 * @param {Options} options options
 * @param {Compilation} compilation compilation
 * @returns {Promise<{ lint: Linter, report: Reporter }>} linter with additional functions
 */
async function linter(options, compilation) {
  /** @type {ESLint} */
  let eslint;

  /** @type {(files: string | string[]) => Promise<LintResult[]>} */
  let lintFiles;

  /** @type {Promise<LintResult[]>[]} */
  const rawResults = [];

  try {
    ({ eslint, lintFiles } = await getESLint(options));
  } catch (err) {
    throw new ESLintError(err.message);
  }

  /**
   * @param {string | string[]} files files
   */
  function lint(files) {
    rawResults.push(
      lintFiles(files).catch((err) => {
        compilation.errors.push(new ESLintError(err.message));
        return [];
      }),
    );
  }

  /**
   * @returns {Promise<Report>} report
   */
  async function report() {
    // Filter out ignored files.
    const results = await removeIgnoredWarnings(
      eslint,
      // Get the current results, resetting the rawResults to empty
      await flatten(rawResults.splice(0)),
    );

    // do not analyze if there are no results or eslint config
    if (!results || results.length < 1) {
      return {};
    }

    const formatter = await loadFormatter(eslint, options.formatter);
    const { errors, warnings } = await formatResults(
      formatter,
      parseResults(options, results),
    );

    /**
     * @param {Compilation} compilation compilation
     * @returns {Promise<void>}
     */
    async function generateReportAsset({ compiler }) {
      const { outputReport } = options;
      /**
       * @param {string} name name
       * @param {string | Buffer} content content
       * @returns {Promise<void>}
       */
      const save = (name, content) =>
        /** @type {Promise<void>} */
        (
          new Promise((finish, bail) => {
            if (!compiler.outputFileSystem) return;

            const { mkdir, writeFile } = compiler.outputFileSystem;

            mkdir(dirname(name), { recursive: true }, (err) => {
              /* istanbul ignore if */
              if (err) {
                bail(err);
              } else {
                writeFile(name, content, (/** @type {unknown} */ err2) => {
                  /* istanbul ignore if */
                  if (err2) bail(err2);
                  else finish();
                });
              }
            });
          })
        );

      if (!outputReport || !outputReport.filePath) {
        return;
      }

      const content = await (outputReport.formatter
        ? (await loadFormatter(eslint, outputReport.formatter)).format(results)
        : formatter.format(results));

      let { filePath } = outputReport;
      if (!isAbsolute(filePath)) {
        filePath = join(compiler.outputPath, filePath);
      }

      await save(filePath, content);
    }

    return {
      errors,
      warnings,
      generateReportAsset,
    };
  }

  return {
    lint,
    report,
  };
}

module.exports = linter;


================================================
FILE: src/options.js
================================================
const { validate } = require("schema-utils");

const schema = require("./options.json");

/** @typedef {import("eslint").ESLint.Options} ESLintOptions */
/** @typedef {import("eslint").ESLint.LintResult} LintResult */

/**
 * @callback FormatterFunction
 * @param {LintResult[]} results results
 * @returns {string} formatted result
 */

/**
 * @typedef {object} OutputReport
 * @property {string=} filePath a file path
 * @property {string | FormatterFunction=} formatter a formatter
 */

/**
 * @typedef {object} PluginOptions
 * @property {string=} context a string indicating the root of your files
 * @property {boolean=} emitError the errors found will always be emitted
 * @property {boolean=} emitWarning the warnings found will always be emitted
 * @property {string | string[]=} exclude specify the files and/or directories to exclude
 * @property {string | string[]=} extensions specify the extensions that should be checked
 * @property {boolean=} failOnError will cause the module build to fail if there are any errors
 * @property {boolean=} failOnWarning will cause the module build to fail if there are any warning
 * @property {string | string[]=} files specify directories, files, or globs
 * @property {boolean=} fix apply fixes
 * @property {string | FormatterFunction=} formatter specify the formatter you would like to use to format your results
 * @property {boolean=} lintDirtyModulesOnly lint only changed files, skip linting on start
 * @property {boolean=} quiet will process and report errors only and ignore warnings
 * @property {string=} eslintPath path to `eslint` instance that will be used for linting
 * @property {OutputReport=} outputReport writes the output of the errors to a file - for example, a `json` file for use for reporting
 * @property {RegExp | RegExp[]=} resourceQueryExclude Specify the resource query to exclude
 * @property {string=} configType config type
 */

/** @typedef {PluginOptions & ESLintOptions} Options */

/**
 * @param {Options} pluginOptions plugin options
 * @returns {PluginOptions} normalized plugin options
 */
function getOptions(pluginOptions) {
  const options = {
    cache: true,
    cacheLocation: "node_modules/.cache/eslint-webpack-plugin/.eslintcache",
    configType: "flat",
    extensions: "js",
    emitError: true,
    emitWarning: true,
    resourceQueryExclude: [],
    ...pluginOptions,
    ...(pluginOptions.quiet ? { emitError: true, emitWarning: false } : {}),
  };

  // @ts-expect-error need better types
  validate(schema, options, {
    name: "ESLint Webpack Plugin",
    baseDataPath: "options",
  });

  return options;
}

/**
 * @param {Options} loaderOptions loader options
 * @returns {ESLintOptions} eslint options
 */
function getESLintOptions(loaderOptions) {
  const eslintOptions = { ...loaderOptions };

  // Keep the fix option because it is common to both the loader and ESLint.
  const { fix, extensions, ...eslintOnlyOptions } = schema.properties;

  // No need to guard the for-in because schema.properties has hardcoded keys.

  for (const option in eslintOnlyOptions) {
    // @ts-expect-error need better types
    delete eslintOptions[option];
  }

  // Some options aren't available in flat mode
  if (loaderOptions.configType === "flat") {
    delete eslintOptions.extensions;
  }

  return eslintOptions;
}

module.exports = {
  getESLintOptions,
  getOptions,
};


================================================
FILE: src/options.json
================================================
{
  "type": "object",
  "additionalProperties": true,
  "properties": {
    "configType": {
      "description": "Specify the type of configuration to use with ESLint, `flat` or `eslintrc`.",
      "type": "string"
    },
    "context": {
      "description": "A string indicating the root of your files.",
      "type": "string"
    },
    "emitError": {
      "description": "The errors found will always be emitted, to disable set to `false`.",
      "type": "boolean"
    },
    "emitWarning": {
      "description": "The warnings found will always be emitted, to disable set to `false`.",
      "type": "boolean"
    },
    "eslintPath": {
      "description": "Path to `eslint` instance that will be used for linting. If the `eslintPath` is a folder like a official eslint, or specify a `formatter` option. now you don't have to install `eslint`.",
      "type": "string"
    },
    "exclude": {
      "description": "Specify the files and/or directories to exclude. Must be relative to `options.context`.",
      "anyOf": [{ "type": "string" }, { "type": "array" }]
    },
    "resourceQueryExclude": {
      "description": "Specify the resource query to exclude.",
      "anyOf": [{ "instanceof": "RegExp" }, { "type": "array" }]
    },
    "failOnError": {
      "description": "Will cause the module build to fail if there are any errors, to disable set to `false`.",
      "type": "boolean"
    },
    "failOnWarning": {
      "description": "Will cause the module build to fail if there are any warnings, if set to `true`.",
      "type": "boolean"
    },
    "files": {
      "description": "Specify the files and/or directories to traverse. Must be relative to `options.context`.",
      "anyOf": [{ "type": "string" }, { "type": "array" }]
    },
    "extensions": {
      "description": "Specify extensions that should be checked.",
      "anyOf": [{ "type": "string" }, { "type": "array" }]
    },
    "fix": {
      "description": "Will enable ESLint autofix feature",
      "type": "boolean"
    },
    "formatter": {
      "description": "Accepts a function that will have one argument: an array of eslint messages (object). The function must return the output as a string.",
      "anyOf": [{ "type": "string" }, { "instanceof": "Function" }]
    },
    "lintDirtyModulesOnly": {
      "description": "Lint only changed files, skip lint on start.",
      "type": "boolean"
    },
    "quiet": {
      "description": "Will process and report errors only and ignore warnings, if set to `true`.",
      "type": "boolean"
    },
    "outputReport": {
      "description": "Write the output of the errors to a file, for example a checkstyle xml file for use for reporting on Jenkins CI",
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "filePath": {
              "description": "The `filePath` is relative to the webpack config: output.path",
              "anyOf": [{ "type": "string" }]
            },
            "formatter": {
              "description": "You can pass in a different formatter for the output file, if none is passed in the default/configured formatter will be used",
              "anyOf": [{ "type": "string" }, { "instanceof": "Function" }]
            }
          }
        }
      ]
    }
  }
}


================================================
FILE: src/utils.js
================================================
// eslint-disable-next-line jsdoc/reject-any-type
/** @typedef {any} EXPECTED_ANY */

const { statSync } = require("node:fs");
const { resolve } = require("node:path");

const normalizePath = require("normalize-path");

/**
 * @template T
 * @typedef {T extends (null | undefined)
 * ? []
 * : T extends string
 * ? [string]
 * : T extends readonly unknown[]
 * ? T
 * : T extends Iterable<infer T>
 * ? T[]
 * : [T]} ArrifyResult
 */

/* istanbul ignore next */
/**
 * @template T
 * @param {T} value value
 * @returns {ArrifyResult<T>} array of values
 */
function arrify(value) {
  if (value === null || value === undefined) {
    return /** @type {ArrifyResult<T>} */ ([]);
  }

  if (Array.isArray(value)) {
    return /** @type {ArrifyResult<T>} */ (value);
  }

  if (typeof value === "string") {
    return /** @type {ArrifyResult<T>} */ ([value]);
  }

  // @ts-expect-error need better types
  if (typeof value[Symbol.iterator] === "function") {
    // @ts-expect-error need better types
    return [...value];
  }

  return /** @type {ArrifyResult<T>} */ ([value]);
}

/**
 * @param {string | string[]} files files
 * @param {string} context context
 * @returns {string[]} normalized paths
 */
function parseFiles(files, context) {
  return arrify(files).map((/** @type {string} */ file) =>
    normalizePath(resolve(context, file)),
  );
}

/**
 * @param {string | string[]} patterns patterns
 * @param {string | string[]} extensions extensions
 * @returns {string[]} globs
 */
function parseFoldersToGlobs(patterns, extensions = []) {
  const extensionsList = arrify(extensions);
  const [prefix, postfix] = extensionsList.length > 1 ? ["{", "}"] : ["", ""];
  const extensionsGlob = extensionsList
    .map((/** @type {string} */ extension) => extension.replace(/^\./u, ""))
    .join(",");

  return arrify(patterns).map((/** @type {string} */ pattern) => {
    try {
      // The patterns are absolute because they are prepended with the context.
      const stats = statSync(pattern);
      /* istanbul ignore else */
      if (stats.isDirectory()) {
        return pattern.replace(
          /[/\\]*?$/u,
          `/**${
            extensionsGlob ? `/*.${prefix + extensionsGlob + postfix}` : ""
          }`,
        );
      }
    } catch {
      // Return the pattern as is on error.
    }
    return pattern;
  });
}

module.exports = {
  arrify,
  parseFiles,
  parseFoldersToGlobs,
};


================================================
FILE: test/.badeslintrc
================================================
{
  "foo": "bar"
}


================================================
FILE: test/autofix-stop.test.js
================================================
import { join } from "node:path";
import { copySync, removeSync } from "fs-extra";

import pack from "./utils/pack";

describe("autofix stop", () => {
  const entry = join(__dirname, "fixtures/nonfixable-clone.js");

  let changed = false;
  let watcher;

  beforeAll(async () => {
    copySync(join(__dirname, "fixtures/nonfixable.js"), entry);
    const chokidar = (await import("chokidar")).default;

    watcher = chokidar.watch(entry);
    watcher.on("change", () => {
      changed = true;
    });
  });

  afterAll(() => {
    watcher.close();
    removeSync(entry);
  });

  it("should not change file if there are no fixable errors/warnings", async () => {
    const compiler = pack("nonfixable-clone", { fix: true });

    await compiler.runAsync();
    expect(changed).toBe(false);
  });
});


================================================
FILE: test/autofix.test.js
================================================
import { join } from "node:path";

import { copySync, readFileSync, removeSync } from "fs-extra";

import pack from "./utils/pack";

describe("autofix stop", () => {
  const entry = join(__dirname, "fixtures/fixable-clone.js");

  beforeAll(() => {
    copySync(join(__dirname, "fixtures/fixable.js"), entry);
  });

  afterAll(() => {
    removeSync(entry);
  });

  it.each([[{}]])(
    "should not throw error if file ok after auto-fixing",
    async (cfg) => {
      const compiler = pack("fixable-clone", {
        ...cfg,
        fix: true,
        extensions: ["js", "cjs", "mjs"],
        overrideConfig: {
          rules: { semi: ["error", "always"] },
        },
      });

      const stats = await compiler.runAsync();
      expect(stats.hasWarnings()).toBe(false);
      expect(stats.hasErrors()).toBe(false);
      expect(readFileSync(entry).toString("utf8")).toMatchInlineSnapshot(`
        "function foo() {
          return true;
        }

        foo();
        "
      `);
    },
  );
});


================================================
FILE: test/cached.test.js
================================================
import { join } from "node:path";

import { removeSync } from "fs-extra";

import webpack from "webpack";

import conf from "./utils/conf";

describe("error (cached module)", () => {
  const cacheLocation = join(__dirname, "cache");

  beforeEach(() => {
    removeSync(cacheLocation);
  });

  afterAll(() => {
    removeSync(cacheLocation);
  });

  it("should return error even if module is cached", (done) => {
    const config = conf("error");
    config.cache = {
      type: "filesystem",
      idleTimeout: 0,
      idleTimeoutAfterLargeChanges: 0,
      idleTimeoutForInitialStore: 0,
      cacheLocation,
    };

    const c1 = webpack(config);

    c1.run((err1, stats1) => {
      expect(err1).toBeNull();
      expect(stats1.hasWarnings()).toBe(false);
      expect(stats1.hasErrors()).toBe(true);

      c1.close(() => {
        const c2 = webpack(config);
        c2.run((err2, stats2) => {
          expect(err2).toBeNull();
          expect(stats2.hasWarnings()).toBe(false);
          expect(stats2.hasErrors()).toBe(true);

          done();
        });
      });
    });
  });
});


================================================
FILE: test/child-compiler.test.js
================================================
import webpack from "webpack";

import conf from "./utils/conf";

const PLUGIN_NAME = "ChildPlugin";
class ChildPlugin {
  constructor(options) {
    this.options = webpack.config.getNormalizedWebpackOptions(options);
  }

  apply(compiler) {
    compiler.hooks.make.tapAsync(PLUGIN_NAME, (compilation, callback) => {
      const childCompiler = compilation.createChildCompiler(PLUGIN_NAME);
      webpack.EntryOptionPlugin.applyEntryOption(
        childCompiler,
        compilation.compiler.context,
        this.options.entry,
      );
      childCompiler.runAsChild(() => {
        callback();
      });
    });
  }
}

describe("child compiler", () => {
  it("should have linting process", (done) => {
    const config = conf("good");
    config.plugins.push(
      new ChildPlugin({
        entry: {
          child: "./child-entry",
        },
      }),
    );
    webpack(config).run((err, stats) => {
      expect(err).toBeNull();
      expect(stats.hasErrors()).toBe(false);
      expect(stats.hasWarnings()).toBe(true);
      done();
    });
  });
});


================================================
FILE: test/circular-plugin.test.js
================================================
import pack from "./utils/pack";

describe("circular plugin", () => {
  it("should support plugins with circular configs", async () => {
    const plugin = {
      configs: {},
      rules: {},
      processors: {},
    };

    Object.assign(plugin.configs, {
      recommended: {
        plugins: {
          self: plugin,
        },
        rules: {},
      },
    });

    const loaderOptions = {
      overrideConfig: {
        plugins: { plugin },
      },
      overrideConfigFile: true,
    };

    const compiler = pack("good", loaderOptions);

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(stats.hasErrors()).toBe(false);
  });
});


================================================
FILE: test/config-for-tests/.eslintrc.js
================================================
module.exports = {
  ignorePatterns: ["**/ignore.js"],
  globals: {
    __dirname: "readonly",
    __filename: "readonly",
    exports: "writable",
    module: "readonly",
    require: "readonly",
    console: "readonly",
  },
  parserOptions: {
    ecmaVersion: 2018,
    env: {
      browser: true,
      node: true,
      es6: true,
    },
    sourceType: "module",
  },
  rules: {
    "no-console": "warn",

    "no-undef": "error",
    "no-var": "error",
    "no-unused-vars": "error",
    "prefer-const": "error",
  },
};


================================================
FILE: test/config-for-tests/eslint.config.mjs
================================================
import { defineConfig } from "eslint/config";
import globals from "globals";

export default defineConfig({
  languageOptions: {
    globals: {
      ...globals.node,
    },
  },
  rules: {
    "no-console": "warn",

    "no-undef": "error",
    "no-var": "error",
    "no-unused-vars": "error",
    "prefer-const": "error",
  },
});


================================================
FILE: test/context.test.js
================================================
import { join } from "node:path";

import pack from "./utils/pack";

describe("context", () => {
  it("absolute", async () => {
    const compiler = pack("good", { context: join(__dirname, "fixtures") });

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(stats.hasErrors()).toBe(false);
  });

  it("relative", async () => {
    const compiler = pack("good", { context: "../fixtures/" });

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(stats.hasErrors()).toBe(false);
  });
});


================================================
FILE: test/emit-error.test.js
================================================
import pack from "./utils/pack";

describe("emit error", () => {
  it("should not emit errors if emitError is false", async () => {
    const compiler = pack("error", { emitError: false });

    const stats = await compiler.runAsync();
    expect(stats.hasErrors()).toBe(false);
  });

  it("should emit errors if emitError is undefined", async () => {
    const compiler = pack("error", {});

    const stats = await compiler.runAsync();
    expect(stats.hasErrors()).toBe(true);
  });

  it("should emit errors if emitError is true", async () => {
    const compiler = pack("error", { emitError: true });

    const stats = await compiler.runAsync();
    expect(stats.hasErrors()).toBe(true);
  });

  it("should emit errors, but not warnings if emitError is true and emitWarning is false", async () => {
    const compiler = pack("full-of-problems", {
      emitError: true,
      emitWarning: false,
    });

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(stats.hasErrors()).toBe(true);
  });

  it("should emit errors and warnings if emitError is true and emitWarning is undefined", async () => {
    const compiler = pack("full-of-problems", { emitError: true });

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(true);
    expect(stats.hasErrors()).toBe(true);
  });
});


================================================
FILE: test/emit-warning.test.js
================================================
import pack from "./utils/pack";

describe("emit warning", () => {
  it("should not emit warnings if emitWarning is false", async () => {
    const compiler = pack("warn", { emitWarning: false });

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
  });

  it("should emit warnings if emitWarning is undefined", async () => {
    const compiler = pack("warn", {});

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(true);
  });

  it("should emit warnings if emitWarning is true", async () => {
    const compiler = pack("warn", { emitWarning: true });

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(true);
  });

  it("should emit warnings, but not warnings if emitWarning is true and emitError is false", async () => {
    const compiler = pack("full-of-problems", {
      emitWarning: true,
      emitError: false,
    });

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(true);
    expect(stats.hasErrors()).toBe(false);
  });

  it("should emit warnings and errors if emitWarning is true and emitError is undefined", async () => {
    const compiler = pack("full-of-problems", { emitWarning: true });

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(true);
    expect(stats.hasErrors()).toBe(true);
  });
});


================================================
FILE: test/empty.test.js
================================================
import { join } from "node:path";

import webpack from "webpack";

import ESLintPlugin from "../src";

describe("empty", () => {
  it("no error when no files matching", (done) => {
    const compiler = webpack({
      context: join(__dirname, "fixtures", "empty"),
      mode: "development",
      entry: "../",
      plugins: [new ESLintPlugin()],
    });

    compiler.run((err, stats) => {
      expect(stats.hasWarnings()).toBe(false);
      expect(stats.hasErrors()).toBe(false);
      done();
    });
  });
});


================================================
FILE: test/error.test.js
================================================
import pack from "./utils/pack";

describe("error", () => {
  afterEach(() => {
    jest.restoreAllMocks();
  });

  it("should return error if file is bad", async () => {
    const compiler = pack("error");

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(stats.hasErrors()).toBe(true);
  });

  it("should propagate eslint exceptions as errors", async () => {
    jest.mock("eslint", () => ({
      ESLint: function ESLint() {
        this.lintFiles = async () => {
          throw new Error("Oh no!");
        };
      },
    }));

    const compiler = pack("good");

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(stats.hasErrors()).toBe(true);
  });
});


================================================
FILE: test/eslint-lint.test.js
================================================
import pack from "./utils/pack";

describe("eslint lint", () => {
  const mockLintFiles = jest.fn().mockReturnValue([]);

  beforeAll(() => {
    jest.mock("eslint", () => {
      function ESLint() {
        this.lintFiles = mockLintFiles;
      }

      ESLint.version = "9.0.0";

      return {
        ESLint,
        async loadESLint() {
          return ESLint;
        },
      };
    });
  });

  beforeEach(() => {
    mockLintFiles.mockClear();
  });

  it("should lint one file", async () => {
    const compiler = pack("lint-one");

    await compiler.runAsync();
    expect(mockLintFiles).toHaveBeenCalledTimes(1);
  });

  it("should lint two files", async () => {
    const compiler = pack("lint-two");

    await compiler.runAsync();
    const files = [
      expect.stringMatching("lint-two-entry.js"),
      expect.stringMatching("lint.js"),
    ];
    expect(mockLintFiles).toHaveBeenCalledWith(files);
  });

  it("should lint more files", async () => {
    const compiler = pack("lint-more");

    await compiler.runAsync();
    const files = [
      expect.stringMatching("lint-more-entry.js"),
      expect.stringMatching("lint-more.js"),
      expect.stringMatching("lint.js"),
    ];
    expect(mockLintFiles).toHaveBeenCalledWith(files);
  });
});


================================================
FILE: test/eslint-options.test.js
================================================
import { getESLintOptions } from "../src/options";

describe("eslint options", () => {
  it("should filter loader options", () => {
    const options = {
      formatter: "table",
      ignore: false,
    };
    expect(getESLintOptions(options)).toStrictEqual({
      ignore: false,
    });
  });

  it("should keep the fix option", () => {
    // The fix option should be kept because it is common to both the loader and ESLint.
    const options = {
      eslintPath: "some/place/where/eslint/lives",
      formatter: "table",
      fix: true,
      emitError: false,
      emitWarning: false,
      failOnError: true,
      failOnWarning: true,
      quiet: false,
      outputReport: true,
    };
    expect(getESLintOptions(options)).toStrictEqual({
      fix: true,
    });
  });
});


================================================
FILE: test/eslint-path.test.js
================================================
import { join } from "node:path";

import pack from "./utils/pack";

describe("eslint path", () => {
  it("should use another instance of eslint via eslintPath config", async () => {
    const eslintPath = join(__dirname, "mock/eslint");
    const compiler = pack("good", { eslintPath });

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(stats.hasErrors()).toBe(true);
    expect(stats.compilation.errors[0].message).toContain("Fake error");
  });
});


================================================
FILE: test/eslintrc-config.test.js
================================================
import { join } from "node:path";

import { ESLint } from "eslint";
import pack from "./utils/pack";

(ESLint && Number.parseFloat(ESLint.version) >= 10 ? describe.skip : describe)(
  "succeed on eslintrc-configuration",
  () => {
    // eslint-disable-next-line jest/require-top-level-describe, jest/consistent-test-it
    it("should work with eslintrc configuration type", async () => {
      const overrideConfigFile = join(
        __dirname,
        "fixtures",
        "eslintrc-config.js",
      );
      const compiler = pack("full-of-problems", {
        configType: "eslintrc",
        overrideConfigFile,
      });

      const stats = await compiler.runAsync();
      const { errors } = stats.compilation;

      expect(stats.hasErrors()).toBe(true);
      expect(errors).toHaveLength(1);
      expect(errors[0].message).toContain("full-of-problems.js");
      expect(stats.hasWarnings()).toBe(true);
    });
  },
);


================================================
FILE: test/exclude.test.js
================================================
import pack from "./utils/pack";

describe("exclude", () => {
  it("should exclude with globs", async () => {
    const compiler = pack("exclude", { exclude: ["*error*"] });

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(stats.hasErrors()).toBe(false);
  });

  it("should exclude files", async () => {
    const compiler = pack("exclude", { exclude: ["error.js"] });

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(stats.hasErrors()).toBe(false);
  });

  it("should exclude folders", async () => {
    const compiler = pack("exclude-folder", { exclude: ["folder"] });

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(stats.hasErrors()).toBe(false);
  });
});


================================================
FILE: test/fail-on-config.test.js
================================================
import { join } from "node:path";

import { ESLint } from "eslint";
import pack from "./utils/pack";

(ESLint && Number.parseFloat(ESLint.version) >= 10 ? describe.skip : describe)(
  "fail on config",
  () => {
    // eslint-disable-next-line jest/require-top-level-describe, jest/consistent-test-it
    it("fails when .eslintrc is not a proper format", async () => {
      const overrideConfigFile = join(__dirname, ".badeslintrc");
      const compiler = pack("error", {
        configType: "eslintrc",
        overrideConfigFile,
      });

      const stats = await compiler.runAsync();
      const { errors } = stats.compilation;
      expect(stats.hasWarnings()).toBe(false);
      expect(stats.hasErrors()).toBe(true);
      expect(errors).toHaveLength(1);
      expect(errors[0].message).toMatch(
        /ESLint configuration in --config is invalid/i,
      );
    });
  },
);


================================================
FILE: test/fail-on-error.test.js
================================================
import pack from "./utils/pack";

describe("fail on error", () => {
  it("should emits errors", async () => {
    const compiler = pack("error", { failOnError: true });

    await expect(compiler.runAsync()).rejects.toThrow("error");
  });

  it("should emit warnings when disabled", async () => {
    const compiler = pack("error", { failOnError: false });

    const stats = await compiler.runAsync();
    expect(stats.hasErrors()).toBe(true);
  });

  it("should correctly identifies a success", async () => {
    const compiler = pack("good", { failOnError: true });

    const stats = await compiler.runAsync();
    expect(stats.hasErrors()).toBe(false);
  });
});


================================================
FILE: test/fail-on-warning.test.js
================================================
import pack from "./utils/pack";

describe("fail on warning", () => {
  it("should emits errors", async () => {
    const compiler = pack("warn", { failOnWarning: true });

    await expect(compiler.runAsync()).rejects.toThrow("warning");
  });

  it("should correctly identifies a success", async () => {
    const compiler = pack("good", { failOnWarning: true });

    const stats = await compiler.runAsync();
    expect(stats.hasErrors()).toBe(false);
  });
});


================================================
FILE: test/fixtures/[symbols]/error.js
================================================
var foo = stuff


================================================
FILE: test/fixtures/[symbols]/symbols-entry.js
================================================
require('./error');


================================================
FILE: test/fixtures/cache.js
================================================
"use strict"

require("./require")

function cacheIt() {
  return "cache"
}

cacheIt()


================================================
FILE: test/fixtures/child-entry.js
================================================
console.log("Hello from child-entry.js");


================================================
FILE: test/fixtures/error-entry.js
================================================
require('./error');


================================================
FILE: test/fixtures/error-warn-entry.js
================================================
require('./error');
require('./warn');


================================================
FILE: test/fixtures/error.js
================================================
var foo = stuff


================================================
FILE: test/fixtures/eslintrc-config.js
================================================
module.exports = {
  root: true,
  parserOptions: {
    ecmaVersion: 2018,
    env: {
      es6: true,
      jest: true,
    },
    sourceType: 'module',
  },
  rules: {
    strict: 'error',
    'global-require': 'off',
  },
};


================================================
FILE: test/fixtures/exclude-entry.js
================================================
require("./error")


================================================
FILE: test/fixtures/exclude-folder-entry.js
================================================
require("./folder/error")


================================================
FILE: test/fixtures/fixable-clone-entry.js
================================================
require('./fixable-clone');


================================================
FILE: test/fixtures/fixable.js
================================================
function foo() {
  return true
}

foo()


================================================
FILE: test/fixtures/flat-config.js
================================================

module.exports = [
    {
        files: ["*.js"],
        rules: {}
    }
];


================================================
FILE: test/fixtures/folder/error.js
================================================
var foo = stuff


================================================
FILE: test/fixtures/folder/readme.md
================================================
This folder is used as a fixture for dirty file watching.


================================================
FILE: test/fixtures/full-of-problems-entry.js
================================================
require('./full-of-problems');

================================================
FILE: test/fixtures/full-of-problems.js
================================================
/* eslint consistent-return: "error" */
/* eslint indent: ["warn", 4] */
/* eslint no-else-return: "warn" */
/* eslint semi: ["warn", "always"] */
/* eslint space-unary-ops: "error" */

function addOne(i) {
  if (i != NaN) {
    return i ++
  } else {
    return
  }
};

================================================
FILE: test/fixtures/good-entry.js
================================================
require("./good");


================================================
FILE: test/fixtures/good.js
================================================
/**
 * @returns {string} value
 */
function test() {
  return "value"
}

test()


================================================
FILE: test/fixtures/ignore-entry.js
================================================
require('./ignore');


================================================
FILE: test/fixtures/ignore.js
================================================
// this file should be totally ignore since it's present in .eslintignore
var -dasdas;


================================================
FILE: test/fixtures/index.js
================================================
module.exports = {}


================================================
FILE: test/fixtures/lint-more-entry.js
================================================
require('./lint-more')


================================================
FILE: test/fixtures/lint-more.js
================================================
require('./lint')


================================================
FILE: test/fixtures/lint-one-entry.js
================================================
//


================================================
FILE: test/fixtures/lint-two-entry.js
================================================
require('./lint')
require('./lint?foo=bar')


================================================
FILE: test/fixtures/lint.js
================================================
function test() {
  return "value"
}

test()


================================================
FILE: test/fixtures/multiple-entry.js
================================================
require("./good");
require("./error");


================================================
FILE: test/fixtures/nonfixable-clone-entry.js
================================================
require('./nonfixable-clone');


================================================
FILE: test/fixtures/nonfixable.js
================================================
function foo() {
  return stuff;
}

foo();


================================================
FILE: test/fixtures/query-entry.js
================================================
// disable: eslint-disable-next-line import/no-unresolved
require('./good?some-query=1234');
// disable: eslint-disable-next-line import/no-unresolved
require('alias-ignore');


================================================
FILE: test/fixtures/require.js
================================================
"use strict"

require("./good")

================================================
FILE: test/fixtures/resource-query-entry.js
================================================
// disable: eslint-disable-next-line import/no-unresolved
require('./media/some-video.ts?media');


================================================
FILE: test/fixtures/warn-entry.js
================================================
require('./warn');


================================================
FILE: test/fixtures/warn-error-entry.js
================================================
require('./warn');
require('./error');


================================================
FILE: test/fixtures/warn.js
================================================
/* eslint no-unused-vars: warn */
const foo = this


================================================
FILE: test/flat-config.test.js
================================================
import { join } from "node:path";
import pack from "./utils/pack";

describe("succeed on flat-configuration", () => {
  it("should work with flat configuration type", async () => {
    const overrideConfigFile = join(__dirname, "fixtures", "flat-config.js");
    const compiler = pack("full-of-problems", {
      configType: "flat",
      overrideConfigFile,
    });

    const stats = await compiler.runAsync();
    const { errors } = stats.compilation;

    expect(stats.hasErrors()).toBe(true);
    expect(errors).toHaveLength(1);
    expect(errors[0].message).toMatch(/full-of-problems\.js/i);
    expect(stats.hasWarnings()).toBe(true);
  });
});


================================================
FILE: test/formatter-custom.test.js
================================================
import pack from "./utils/pack";

describe("formatter eslint", () => {
  it("should use custom formatter as function", async () => {
    const formatter = require("./mock/formatter");

    const compiler = pack("error", { formatter });

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(stats.hasErrors()).toBe(true);
    expect(stats.compilation.errors[0].message).toBeTruthy();
    const message = JSON.parse(
      stats.compilation.errors[0].message.replace("[eslint] ", ""),
    );
    expect(message.formatter).toBe("mock");
    expect(message.results).toBeTruthy();
  });

  it("should use custom formatter as string", async () => {
    const formatter = "./test/mock/formatter";
    const compiler = pack("error", { formatter });

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(stats.hasErrors()).toBe(true);
    expect(stats.compilation.errors[0].message).toBeTruthy();
    const message = JSON.parse(
      stats.compilation.errors[0].message.replace("[eslint] ", ""),
    );
    expect(message.formatter).toBe("mock");
    expect(message.results).toBeTruthy();
  });
});


================================================
FILE: test/formatter-eslint.test.js
================================================
import pack from "./utils/pack";

describe("formatter eslint", () => {
  it("should use eslint formatter", async () => {
    const compiler = pack("error");

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(stats.hasErrors()).toBe(true);
    expect(stats.compilation.errors[0].message).toBeTruthy();
  });
});


================================================
FILE: test/formatter-official.test.js
================================================
import pack from "./utils/pack";

describe("formatter official", () => {
  it("should use official formatter", async () => {
    const compiler = pack("error", { formatter: "json" });

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(stats.hasErrors()).toBe(true);
    expect(stats.compilation.errors[0].message).toBeTruthy();
  });
});


================================================
FILE: test/formatter-write.test.js
================================================
import { join } from "node:path";

import { readFileSync, removeSync } from "fs-extra";
import webpack from "webpack";

import conf from "./utils/conf";

describe("formatter write", () => {
  it("should write results to relative file with a custom formatter", (done) => {
    const outputFilename = "outputReport-relative.txt";
    const config = conf("error", {
      formatter: "json",
      outputReport: {
        formatter: "json",
        filePath: outputFilename,
      },
    });

    const outputFilepath = join(config.output.path, outputFilename);
    removeSync(outputFilepath);

    const compiler = webpack(config);
    compiler.run((err, stats) => {
      const contents = readFileSync(outputFilepath, "utf8");

      expect(err).toBeNull();
      expect(stats.hasWarnings()).toBe(false);
      expect(stats.hasErrors()).toBe(true);
      expect(stats.compilation.errors[0].message).toBe(`[eslint] ${contents}`);
      done();
    });
  });

  it("should write results to absolute file with a same formatter", (done) => {
    const outputFilename = "outputReport-absolute.txt";
    const outputFilepath = join(__dirname, "outputs", outputFilename);
    const config = conf("error", {
      outputReport: {
        filePath: outputFilepath,
      },
    });

    removeSync(outputFilepath);

    const compiler = webpack(config);
    compiler.run((err, stats) => {
      const contents = readFileSync(outputFilepath, "utf8");

      expect(err).toBeNull();
      expect(stats.hasWarnings()).toBe(false);
      expect(stats.hasErrors()).toBe(true);
      expect(stats.compilation.errors[0].message).toBe(`[eslint] ${contents}`);
      done();
    });
  });
});


================================================
FILE: test/ignore.test.js
================================================
import ESLintError from "../src/ESLintError";
import pack from "./utils/pack";

describe("eslintignore", () => {
  it("should ignores files present in .eslintignore", async () => {
    const compiler = pack("ignore", {
      ignore: true,
      ignorePatterns: ["**/ignore.js"],
    });

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(
      stats.compilation.errors.filter((x) => x instanceof ESLintError),
    ).toEqual([]);
  });
});


================================================
FILE: test/lint-dirty-modules-only.test.js
================================================
import { writeFileSync } from "node:fs";
import { join } from "node:path";

import { removeSync } from "fs-extra";

import pack from "./utils/pack";

const target = join(__dirname, "fixtures", "lint-dirty-modules-only-entry.js");

describe("lint dirty modules only", () => {
  let watch;

  afterEach(() => {
    if (watch) {
      watch.close();
    }
    removeSync(target);
  });

  it("skips linting on initial run", (done) => {
    writeFileSync(target, "const foo = false\n");

    // eslint-disable-next-line no-use-before-define
    let next = firstPass;
    const compiler = pack("lint-dirty-modules-only", {
      lintDirtyModulesOnly: true,
    });
    watch = compiler.watch({}, (err, stats) => next(err, stats));

    function secondPass(err, stats) {
      expect(err).toBeNull();
      expect(stats.hasWarnings()).toBe(false);
      expect(stats.hasErrors()).toBe(true);
      const { errors } = stats.compilation;
      expect(errors).toHaveLength(1);
      expect(stats.compilation.errors[0].message).toEqual(
        expect.stringMatching("no-unused-vars"),
      );
      done();
    }

    function firstPass(err, stats) {
      expect(err).toBeNull();
      expect(stats.hasWarnings()).toBe(false);
      expect(stats.hasErrors()).toBe(false);

      next = secondPass;

      writeFileSync(target, "const bar = false;\n");
    }
  });
});


================================================
FILE: test/mock/eslint/index.js
================================================
class ESLintMock {
  // Disabled because these are simplified mock methods.

  async lintFiles() {
    return [
      {
        filePath: "",
        messages: [
          {
            ruleId: "no-undef",
            severity: 2,
            message: "Fake error",
            line: 1,
            column: 11,
          },
        ],
        errorCount: 2,
        warningCount: 0,
        fixableErrorCount: 0,
        fixableWarningCount: 0,
        source: "",
      },
    ];
  }

  async loadFormatter() {
    return {
      format(results) {
        return JSON.stringify(results);
      },
    };
  }
}

ESLintMock.version = "9";

module.exports = {
  ESLint: ESLintMock,
  loadESLint: async () => ESLintMock,
};


================================================
FILE: test/mock/eslint/package.json
================================================
{
  "name": "eslint",
  "version": "7.0.0"
}


================================================
FILE: test/mock/formatter/index.js
================================================
module.exports = function format(results) {
  return JSON.stringify({
    formatter: "mock",
    results,
  });
};


================================================
FILE: test/multiple-instances.test.js
================================================
import { join } from "node:path";
import ESLintPlugin from "../src";
import pack from "./utils/pack";

describe("multiple instances", () => {
  it("should don't fail", async () => {
    const compiler = pack(
      "multiple",
      {},
      {
        plugins: [
          new ESLintPlugin({
            failOnError: true,
            overrideConfigFile: join(
              __dirname,
              "./config-for-tests/eslint.config.mjs",
            ),
            ignore: false,
            exclude: "error.js",
          }),
          new ESLintPlugin({
            failOnError: true,
            overrideConfigFile: join(
              __dirname,
              "./config-for-tests/eslint.config.mjs",
            ),
            ignore: false,
            exclude: "error.js",
          }),
        ],
      },
    );

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(stats.hasErrors()).toBe(false);
  });

  it("should fail on first instance", async () => {
    const compiler = pack(
      "multiple",
      {},
      {
        plugins: [
          new ESLintPlugin({
            failOnError: true,
            overrideConfigFile: join(
              __dirname,
              "./config-for-tests/eslint.config.mjs",
            ),
            ignore: false,
            exclude: "good.js",
          }),
          new ESLintPlugin({
            failOnError: true,
            overrideConfigFile: join(
              __dirname,
              "./config-for-tests/eslint.config.mjs",
            ),
            ignore: false,
            exclude: "error.js",
          }),
        ],
      },
    );

    await expect(compiler.runAsync()).rejects.toThrow("error.js");
  });

  it("should fail on second instance", async () => {
    const compiler = pack(
      "multiple",
      {},
      {
        plugins: [
          new ESLintPlugin({
            failOnError: true,
            overrideConfigFile: join(
              __dirname,
              "./config-for-tests/eslint.config.mjs",
            ),
            ignore: false,
            exclude: "error.js",
          }),
          new ESLintPlugin({
            failOnError: true,
            overrideConfigFile: join(
              __dirname,
              "./config-for-tests/eslint.config.mjs",
            ),
            ignore: false,
            exclude: "good.js",
          }),
        ],
      },
    );

    await expect(compiler.runAsync()).rejects.toThrow("error.js");
  });
});


================================================
FILE: test/ok.test.js
================================================
import pack from "./utils/pack";

describe("ok", () => {
  it("should don't throw error if file is ok", async () => {
    const compiler = pack("good");

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(stats.hasErrors()).toBe(false);
  });
});


================================================
FILE: test/parameters.test.js
================================================
import pack from "./utils/pack";

describe("parameters", () => {
  it("should supports query strings parameters", async () => {
    const loaderOptions = {
      overrideConfig: {
        rules: { semi: 0 },
      },
    };
    const compiler = pack("good", loaderOptions);

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(stats.hasErrors()).toBe(false);
  });
});


================================================
FILE: test/query.test.js
================================================
import pack from "./utils/pack";

describe("query", () => {
  it("should correctly resolve file despite query path", async () => {
    const compiler = pack(
      "query",
      {},
      {
        resolve: {
          alias: {
            "alias-ignore": false,
          },
        },
      },
    );

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(stats.hasErrors()).toBe(false);
  });
});


================================================
FILE: test/quiet.test.js
================================================
import pack from "./utils/pack";

describe("quiet", () => {
  it("should not emit warnings if quiet is set", async () => {
    const compiler = pack("warn", { quiet: true });

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(stats.hasErrors()).toBe(false);
  });

  it("should emit errors, but not emit warnings if quiet is set", async () => {
    const compiler = pack("full-of-problems", { quiet: true });

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(stats.hasErrors()).toBe(true);
  });
});


================================================
FILE: test/resource-query.test.js
================================================
import pack from "./utils/pack";

describe("resource-query", () => {
  it("should exclude the match resource query", async () => {
    const compiler = pack(
      "resource-query",
      {
        resourceQueryExclude: /media/,
        extensions: [".js", ".ts"],
      },
      {
        module: { rules: [{ resourceQuery: /media/, type: "asset/source" }] },
      },
    );

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(stats.hasErrors()).toBe(false);
  });
});


================================================
FILE: test/symbols.test.js
================================================
import { join } from "node:path";

import pack from "./utils/pack";

describe("symbols", () => {
  afterEach(() => {
    jest.restoreAllMocks();
  });

  it("should return error", async () => {
    const compiler = pack(
      "symbols",
      {},
      { context: join(__dirname, "fixtures/[symbols]") },
    );

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(false);
    expect(stats.hasErrors()).toBe(true);
  });
});


================================================
FILE: test/threads.test.js
================================================
import workerThreads from "node:worker_threads";
import pack from "./utils/pack";

describe("Multithread", () => {
  let workerCount;
  let originalWorker;

  beforeEach(() => {
    workerCount = 0;
    originalWorker = workerThreads.Worker;
    workerThreads.Worker = class TrackedWorker extends originalWorker {
      constructor(...args) {
        super(...args);
        workerCount++;
      }
    };
  });

  afterEach(() => {
    workerThreads.Worker = originalWorker;
  });

  it("should spawn worker threads with concurrency=2", async () => {
    const compiler = pack("good", { concurrency: 2 });

    const stats = await compiler.runAsync();

    expect(stats.hasErrors()).toBe(false);
    expect(workerCount).toBeGreaterThanOrEqual(2);
  });

  it("should not spawn worker threads with concurrency=off", async () => {
    const compiler = pack("good", { concurrency: "off" });

    const stats = await compiler.runAsync();

    expect(stats.hasErrors()).toBe(false);
    expect(workerCount).toBe(0);
  });
});


================================================
FILE: test/utils/conf.js
================================================
import { join } from "node:path";
import ESLintPlugin from "../../src";

export default (entry, pluginConf = {}, webpackConf = {}) => {
  const testDir = join(__dirname, "..");

  return {
    entry: `./${entry}-entry.js`,
    context: join(testDir, "fixtures"),
    mode: "development",
    output: {
      path: join(testDir, "outputs"),
    },
    plugins: [
      new ESLintPlugin({
        // Do not cache for tests
        cache: false,
        overrideConfigFile: join(
          testDir,
          "./config-for-tests/eslint.config.mjs",
        ),
        // this disables the use of .eslintignore, since it contains the fixtures
        // folder to skip it on the global linting, but here we want the opposite
        ignore: false,
        ...pluginConf,
      }),
    ],
    ...webpackConf,
  };
};


================================================
FILE: test/utils/pack.js
================================================
import webpack from "webpack";

import conf from "./conf";

/**
 * new a test webpack compiler
 * @param {string} context context
 * @param {import("../../src/options").Options} pluginConf plugin options
 * @param {webpack.Configuration} webpackConf webpack configuration
 * @returns {ReturnType<webpack>} return result from webpack
 */
export default (context, pluginConf = {}, webpackConf = {}) => {
  const compiler = webpack(conf(context, pluginConf, webpackConf));

  return {
    runAsync() {
      return new Promise((resolve, reject) => {
        compiler.run((err, stats) => {
          if (err) {
            reject(err);
          } else {
            resolve(stats);
          }
        });
      });
    },
    watch(options, fn) {
      return compiler.watch(options, fn);
    },
  };
};


================================================
FILE: test/utils.test.js
================================================
import { parseFiles, parseFoldersToGlobs } from "../src/utils";

jest.mock("fs", () => ({
  statSync(pattern) {
    return {
      isDirectory() {
        return pattern.indexOf("/path/") === 0;
      },
    };
  },
}));

describe("utils", () => {
  it("parseFiles should return relative files from context", () => {
    expect(
      parseFiles(
        ["**/*", "../package-a/src/**/", "../package-b/src/**/"],
        "main/src",
      ),
    ).toEqual(
      expect.arrayContaining([
        expect.stringContaining("main/src/**/*"),
        expect.stringContaining("main/package-a/src/**"),
        expect.stringContaining("main/package-b/src/**"),
      ]),
    );
  });

  it("parseFoldersToGlobs should return globs for folders", () => {
    const withoutSlash = "/path/to/code";
    const withSlash = `${withoutSlash}/`;

    expect(parseFoldersToGlobs(withoutSlash, "js")).toMatchInlineSnapshot(`
    [
      "/path/to/code/**/*.js",
    ]
  `);
    expect(parseFoldersToGlobs(withSlash, "js")).toMatchInlineSnapshot(`
    [
      "/path/to/code/**/*.js",
    ]
  `);

    expect(
      parseFoldersToGlobs(
        [withoutSlash, withSlash, "/some/file.js"],
        ["js", "cjs", "mjs"],
      ),
    ).toMatchInlineSnapshot(`
    [
      "/path/to/code/**/*.{js,cjs,mjs}",
      "/path/to/code/**/*.{js,cjs,mjs}",
      "/some/file.js",
    ]
  `);

    expect(parseFoldersToGlobs(withoutSlash)).toMatchInlineSnapshot(`
    [
      "/path/to/code/**",
    ]
  `);

    expect(parseFoldersToGlobs(withSlash)).toMatchInlineSnapshot(`
    [
      "/path/to/code/**",
    ]
  `);
  });

  it("parseFoldersToGlobs should return unmodified globs for globs (ignoring extensions)", () => {
    expect(parseFoldersToGlobs("**.notjs", "js")).toMatchInlineSnapshot(`
    [
      "**.notjs",
    ]
  `);
  });
});


================================================
FILE: test/warning.test.js
================================================
import pack from "./utils/pack";

describe("warning", () => {
  it("should emit warnings", async () => {
    const compiler = pack("warn");

    const stats = await compiler.runAsync();
    expect(stats.hasWarnings()).toBe(true);
    expect(stats.hasErrors()).toBe(false);
  });
});


================================================
FILE: test/watch.test.js
================================================
import { writeFileSync } from "node:fs";
import { join } from "node:path";

import { removeSync } from "fs-extra";

import pack from "./utils/pack";

const target = join(__dirname, "fixtures", "watch-entry.js");
const target2 = join(__dirname, "fixtures", "watch-leaf.js");
const targetExpectedPattern = expect.stringMatching(
  target.replaceAll("\\", "\\\\"),
);

describe("watch", () => {
  let watch;

  afterEach(() => {
    if (watch) {
      watch.close();
    }
    removeSync(target);
    removeSync(target2);
  });

  it("should watch", (done) => {
    const compiler = pack("good");

    watch = compiler.watch({}, (err, stats) => {
      expect(err).toBeNull();
      expect(stats.hasWarnings()).toBe(false);
      expect(stats.hasErrors()).toBe(false);
      done();
    });
  });

  it("should watch with unique messages", (done) => {
    writeFileSync(target, "var foo = stuff\n");

    // eslint-disable-next-line no-use-before-define
    let next = firstPass;
    const compiler = pack("watch");
    watch = compiler.watch({}, (err, stats) => next(err, stats));

    function finish(err, stats) {
      expect(err).toBeNull();
      expect(stats.hasWarnings()).toBe(false);
      expect(stats.hasErrors()).toBe(false);
      done();
    }

    function thirdPass(err, stats) {
      expect(err).toBeNull();
      expect(stats.hasWarnings()).toBe(false);
      expect(stats.hasErrors()).toBe(true);
      const { errors } = stats.compilation;
      expect(errors).toHaveLength(1);
      const [{ message }] = errors;
      expect(message).toEqual(targetExpectedPattern);
      expect(message).toEqual(expect.stringMatching("no-unused-vars"));
      // `prefer-const` fails here
      expect(message).toEqual(expect.stringMatching("prefer-const"));
      expect(message).toEqual(expect.stringMatching("\\(4 errors,"));

      next = finish;

      writeFileSync(
        target,
        "/* eslint-disable no-unused-vars */\nconst foo = false;\n",
      );
    }

    function secondPass(err, stats) {
      expect(err).toBeNull();
      expect(stats.hasWarnings()).toBe(false);
      expect(stats.hasErrors()).toBe(true);
      const { errors } = stats.compilation;
      expect(errors).toHaveLength(1);
      const [{ message }] = errors;
      expect(message).toEqual(targetExpectedPattern);
      expect(message).toEqual(expect.stringMatching("no-unused-vars"));
      // `prefer-const` passes here
      expect(message).toEqual(expect.stringMatching("prefer-const"));
      expect(message).toEqual(expect.stringMatching("\\(4 errors,"));

      next = thirdPass;

      writeFileSync(
        target,
        "const x = require('./watch-leaf')\nconst foo = 0\n",
      );
    }

    function firstPass(err, stats) {
      expect(err).toBeNull();
      expect(stats.hasWarnings()).toBe(false);
      expect(stats.hasErrors()).toBe(true);
      const { errors } = stats.compilation;
      expect(errors).toHaveLength(1);
      const [{ message }] = errors;
      expect(message).toEqual(targetExpectedPattern);
      expect(message).toEqual(expect.stringMatching("\\(3 errors,"));

      next = secondPass;

      writeFileSync(target2, "let bar = false;\n");
      writeFileSync(
        target,
        "const x = require('./watch-leaf')\n\nconst foo = false;\n",
      );
    }
  });
});


================================================
FILE: tsconfig.json
================================================
{
  "compilerOptions": {
    "target": "esnext",
    "moduleResolution": "node",
    "allowJs": true,
    "checkJs": true,
    "strict": true,
    "useUnknownInCatchVariables": false,
    "types": ["node"],
    "resolveJsonModule": true
  },
  "include": ["./src/**/*"]
}


================================================
FILE: types/ESLintError.d.ts
================================================
export = ESLintError;
declare class ESLintError extends Error {
  /**
   * @param {string=} messages messages
   */
  constructor(messages?: string | undefined);
  stack: string;
}


================================================
FILE: types/getESLint.d.ts
================================================
export type ESLint = import("eslint").ESLint;
export type LintResult = import("eslint").ESLint.LintResult;
export type Options = import("./options").Options;
export type LintTask = (files: string | string[]) => Promise<LintResult[]>;
export type Linter = {
  eslint: ESLint;
  lintFiles: LintTask;
};
export type ESLintOptions = import("eslint").ESLint.Options;
export type ESLintClass = {
  new (arg0: ESLintOptions): ESLint;
  outputFixes: (arg0: LintResult[]) => Promise<void>;
};
/** @typedef {import("eslint").ESLint} ESLint */
/** @typedef {import("eslint").ESLint.LintResult} LintResult */
/** @typedef {import("./options").Options} Options */
/** @typedef {(files: string | string[]) => Promise<LintResult[]>} LintTask */
/** @typedef {{ eslint: ESLint, lintFiles: LintTask }} Linter */
/** @typedef {import("eslint").ESLint.Options} ESLintOptions */
/** @typedef {{ new (arg0: ESLintOptions): ESLint, outputFixes: (arg0: LintResult[]) => Promise<void> }} ESLintClass */
/**
 * @param {Options} options options
 * @returns {Promise<Linter>} linter
 */
export function getESLint(options: Options): Promise<Linter>;


================================================
FILE: types/index.d.ts
================================================
export = ESLintWebpackPlugin;
declare class ESLintWebpackPlugin {
  /**
   * @param {Options=} options options
   */
  constructor(options?: Options | undefined);
  key: string;
  options: import("./options").PluginOptions;
  /**
   * @param {Compiler} compiler compiler
   * @param {Omit<Options, "resourceQueryExclude"> & { resourceQueryExclude: RegExp[] }} options options
   * @param {string[]} wanted wanted files
   * @param {string[]} exclude excluded files
   */
  run(
    compiler: Compiler,
    options: Omit<Options, "resourceQueryExclude"> & {
      resourceQueryExclude: RegExp[];
    },
    wanted: string[],
    exclude: string[],
  ): Promise<void>;
  /**
   * @param {Compiler} compiler compiler
   * @returns {void}
   */
  apply(compiler: Compiler): void;
  /**
   * @param {Compiler} compiler compiler
   * @returns {string} context
   */
  getContext(compiler: Compiler): string;
}
declare namespace ESLintWebpackPlugin {
  export { Compiler, Module, NormalModule, Options };
}
type Compiler = import("webpack").Compiler;
type Module = import("webpack").Module;
type NormalModule = import("webpack").NormalModule;
type Options = import("./options").Options;


================================================
FILE: types/linter.d.ts
================================================
export = linter;
/**
 * @param {Options} options options
 * @param {Compilation} compilation compilation
 * @returns {Promise<{ lint: Linter, report: Reporter }>} linter with additional functions
 */
declare function linter(
  options: Options,
  compilation: Compilation,
): Promise<{
  lint: Linter;
  report: Reporter;
}>;
declare namespace linter {
  export {
    ESLint,
    Formatter,
    LintResult,
    Compiler,
    Compilation,
    Options,
    FormatterFunction,
    GenerateReport,
    Report,
    Reporter,
    Linter,
    LintResultMap,
  };
}
type ESLint = import("eslint").ESLint;
type Formatter = import("eslint").ESLint.Formatter;
type LintResult = import("eslint").ESLint.LintResult;
type Compiler = import("webpack").Compiler;
type Compilation = import("webpack").Compilation;
type Options = import("./options").Options;
type FormatterFunction = import("./options").FormatterFunction;
type GenerateReport = (compilation: Compilation) => Promise<void>;
type Report = {
  errors?: ESLintError;
  warnings?: ESLintError;
  generateReportAsset?: GenerateReport;
};
type Reporter = () => Promise<Report>;
type Linter = (files: string | string[]) => void;
type LintResultMap = {
  [files: string]: LintResult;
};
import ESLintError = require("./ESLintError");


================================================
FILE: types/options.d.ts
================================================
export type ESLintOptions = import("eslint").ESLint.Options;
export type LintResult = import("eslint").ESLint.LintResult;
export type FormatterFunction = (results: LintResult[]) => string;
export type OutputReport = {
  /**
   * a file path
   */
  filePath?: string | undefined;
  /**
   * a formatter
   */
  formatter?: (string | FormatterFunction) | undefined;
};
export type PluginOptions = {
  /**
   * a string indicating the root of your files
   */
  context?: string | undefined;
  /**
   * the errors found will always be emitted
   */
  emitError?: boolean | undefined;
  /**
   * the warnings found will always be emitted
   */
  emitWarning?: boolean | undefined;
  /**
   * specify the files and/or directories to exclude
   */
  exclude?: (string | string[]) | undefined;
  /**
   * specify the extensions that should be checked
   */
  extensions?: (string | string[]) | undefined;
  /**
   * will cause the module build to fail if there are any errors
   */
  failOnError?: boolean | undefined;
  /**
   * will cause the module build to fail if there are any warning
   */
  failOnWarning?: boolean | undefined;
  /**
   * specify directories, files, or globs
   */
  files?: (string | string[]) | undefined;
  /**
   * apply fixes
   */
  fix?: boolean | undefined;
  /**
   * specify the formatter you would like to use to format your results
   */
  formatter?: (string | FormatterFunction) | undefined;
  /**
   * lint only changed files, skip linting on start
   */
  lintDirtyModulesOnly?: boolean | undefined;
  /**
   * will process and report errors only and ignore warnings
   */
  quiet?: boolean | undefined;
  /**
   * path to `eslint` instance that will be used for linting
   */
  eslintPath?: string | undefined;
  /**
   * writes the output of the errors to a file - for example, a `json` file for use for reporting
   */
  outputReport?: OutputReport | undefined;
  /**
   * Specify the resource query to exclude
   */
  resourceQueryExclude?: (RegExp | RegExp[]) | undefined;
  /**
   * config type
   */
  configType?: string | undefined;
};
export type Options = PluginOptions & ESLintOptions;
/**
 * @param {Options} loaderOptions loader options
 * @returns {ESLintOptions} eslint options
 */
export function getESLintOptions(loaderOptions: Options): ESLintOptions;
/** @typedef {import("eslint").ESLint.Options} ESLintOptions */
/** @typedef {import("eslint").ESLint.LintResult} LintResult */
/**
 * @callback FormatterFunction
 * @param {LintResult[]} results results
 * @returns {string} formatted result
 */
/**
 * @typedef {object} OutputReport
 * @property {string=} filePath a file path
 * @property {string | FormatterFunction=} formatter a formatter
 */
/**
 * @typedef {object} PluginOptions
 * @property {string=} context a string indicating the root of your files
 * @property {boolean=} emitError the errors found will always be emitted
 * @property {boolean=} emitWarning the warnings found will always be emitted
 * @property {string | string[]=} exclude specify the files and/or directories to exclude
 * @property {string | string[]=} extensions specify the extensions that should be checked
 * @property {boolean=} failOnError will cause the module build to fail if there are any errors
 * @property {boolean=} failOnWarning will cause the module build to fail if there are any warning
 * @property {string | string[]=} files specify directories, files, or globs
 * @property {boolean=} fix apply fixes
 * @property {string | FormatterFunction=} formatter specify the formatter you would like to use to format your results
 * @property {boolean=} lintDirtyModulesOnly lint only changed files, skip linting on start
 * @property {boolean=} quiet will process and report errors only and ignore warnings
 * @property {string=} eslintPath path to `eslint` instance that will be used for linting
 * @property {OutputReport=} outputReport writes the output of the errors to a file - for example, a `json` file for use for reporting
 * @property {RegExp | RegExp[]=} resourceQueryExclude Specify the resource query to exclude
 * @property {string=} configType config type
 */
/** @typedef {PluginOptions & ESLintOptions} Options */
/**
 * @param {Options} pluginOptions plugin options
 * @returns {PluginOptions} normalized plugin options
 */
export function getOptions(pluginOptions: Options): PluginOptions;


================================================
FILE: types/utils.d.ts
================================================
export type ArrifyResult<T> = T extends null | undefined
  ? []
  : T extends string
    ? [string]
    : T extends readonly unknown[]
      ? T
      : T extends Iterable<infer T_1>
        ? T_1[]
        : [T];
export type EXPECTED_ANY = any;
/**
 * @template T
 * @typedef {T extends (null | undefined)
 * ? []
 * : T extends string
 * ? [string]
 * : T extends readonly unknown[]
 * ? T
 * : T extends Iterable<infer T>
 * ? T[]
 * : [T]} ArrifyResult
 */
/**
 * @template T
 * @param {T} value value
 * @returns {ArrifyResult<T>} array of values
 */
export function arrify<T>(value: T): ArrifyResult<T>;
/**
 * @param {string | string[]} files files
 * @param {string} context context
 * @returns {string[]} normalized paths
 */
export function parseFiles(files: string | string[], context: string): string[];
/**
 * @param {string | string[]} patterns patterns
 * @param {string | string[]} extensions extensions
 * @returns {string[]} globs
 */
export function parseFoldersToGlobs(
  patterns: string | string[],
  extensions?: string | string[],
): string[];
Download .txt
gitextract_ibjnkmu0/

├── .cspell.json
├── .editorconfig
├── .gitattributes
├── .github/
│   └── workflows/
│       ├── dependency-review.yml
│       └── nodejs.yml
├── .gitignore
├── .prettierignore
├── CHANGELOG.md
├── LICENSE
├── README.md
├── babel.config.js
├── commitlint.config.js
├── eslint.config.mjs
├── husky.config.js
├── jest.config.js
├── lint-staged.config.js
├── package.json
├── src/
│   ├── ESLintError.js
│   ├── getESLint.js
│   ├── index.js
│   ├── linter.js
│   ├── options.js
│   ├── options.json
│   └── utils.js
├── test/
│   ├── .badeslintrc
│   ├── autofix-stop.test.js
│   ├── autofix.test.js
│   ├── cached.test.js
│   ├── child-compiler.test.js
│   ├── circular-plugin.test.js
│   ├── config-for-tests/
│   │   ├── .eslintrc.js
│   │   └── eslint.config.mjs
│   ├── context.test.js
│   ├── emit-error.test.js
│   ├── emit-warning.test.js
│   ├── empty.test.js
│   ├── error.test.js
│   ├── eslint-lint.test.js
│   ├── eslint-options.test.js
│   ├── eslint-path.test.js
│   ├── eslintrc-config.test.js
│   ├── exclude.test.js
│   ├── fail-on-config.test.js
│   ├── fail-on-error.test.js
│   ├── fail-on-warning.test.js
│   ├── fixtures/
│   │   ├── [symbols]/
│   │   │   ├── error.js
│   │   │   └── symbols-entry.js
│   │   ├── cache.js
│   │   ├── child-entry.js
│   │   ├── error-entry.js
│   │   ├── error-warn-entry.js
│   │   ├── error.js
│   │   ├── eslintrc-config.js
│   │   ├── exclude-entry.js
│   │   ├── exclude-folder-entry.js
│   │   ├── fixable-clone-entry.js
│   │   ├── fixable.js
│   │   ├── flat-config.js
│   │   ├── folder/
│   │   │   ├── error.js
│   │   │   └── readme.md
│   │   ├── full-of-problems-entry.js
│   │   ├── full-of-problems.js
│   │   ├── good-entry.js
│   │   ├── good.js
│   │   ├── ignore-entry.js
│   │   ├── ignore.js
│   │   ├── index.js
│   │   ├── lint-more-entry.js
│   │   ├── lint-more.js
│   │   ├── lint-one-entry.js
│   │   ├── lint-two-entry.js
│   │   ├── lint.js
│   │   ├── media/
│   │   │   └── some-video.ts
│   │   ├── multiple-entry.js
│   │   ├── nonfixable-clone-entry.js
│   │   ├── nonfixable.js
│   │   ├── query-entry.js
│   │   ├── require.js
│   │   ├── resource-query-entry.js
│   │   ├── warn-entry.js
│   │   ├── warn-error-entry.js
│   │   └── warn.js
│   ├── flat-config.test.js
│   ├── formatter-custom.test.js
│   ├── formatter-eslint.test.js
│   ├── formatter-official.test.js
│   ├── formatter-write.test.js
│   ├── ignore.test.js
│   ├── lint-dirty-modules-only.test.js
│   ├── mock/
│   │   ├── eslint/
│   │   │   ├── index.js
│   │   │   └── package.json
│   │   └── formatter/
│   │       └── index.js
│   ├── multiple-instances.test.js
│   ├── ok.test.js
│   ├── parameters.test.js
│   ├── query.test.js
│   ├── quiet.test.js
│   ├── resource-query.test.js
│   ├── symbols.test.js
│   ├── threads.test.js
│   ├── utils/
│   │   ├── conf.js
│   │   └── pack.js
│   ├── utils.test.js
│   ├── warning.test.js
│   └── watch.test.js
├── tsconfig.json
└── types/
    ├── ESLintError.d.ts
    ├── getESLint.d.ts
    ├── index.d.ts
    ├── linter.d.ts
    ├── options.d.ts
    └── utils.d.ts
Download .txt
SYMBOL INDEX (82 symbols across 27 files)

FILE: babel.config.js
  constant MIN_BABEL_VERSION (line 1) | const MIN_BABEL_VERSION = 7;

FILE: src/ESLintError.js
  class ESLintError (line 1) | class ESLintError extends Error {
    method constructor (line 5) | constructor(messages) {

FILE: src/getESLint.js
  function getESLint (line 15) | async function getESLint(options) {

FILE: src/index.js
  constant ESLINT_PLUGIN (line 14) | const ESLINT_PLUGIN = "ESLintWebpackPlugin";
  constant DEFAULT_FOLDER_TO_EXCLUDE (line 15) | const DEFAULT_FOLDER_TO_EXCLUDE = "**/node_modules/**";
  class ESLintWebpackPlugin (line 19) | class ESLintWebpackPlugin {
    method constructor (line 23) | constructor(options = {}) {
    method apply (line 33) | apply(compiler) {
    method run (line 89) | async run(compiler, options, wanted, exclude) {
    method getContext (line 181) | getContext(compiler) {

FILE: src/linter.js
  function flatten (line 23) | async function flatten(results) {
  function removeIgnoredWarnings (line 38) | async function removeIgnoredWarnings(eslint, results) {
  function loadFormatter (line 67) | async function loadFormatter(eslint, formatter) {
  function formatResults (line 88) | async function formatResults(formatter, results) {
  function fileHasErrors (line 109) | function fileHasErrors(file) {
  function fileHasWarnings (line 117) | function fileHasWarnings(file) {
  function parseResults (line 126) | function parseResults(options, results) {
  function linter (line 166) | async function linter(options, compilation) {

FILE: src/options.js
  function getOptions (line 46) | function getOptions(pluginOptions) {
  function getESLintOptions (line 72) | function getESLintOptions(loaderOptions) {

FILE: src/utils.js
  function arrify (line 28) | function arrify(value) {
  function parseFiles (line 55) | function parseFiles(files, context) {
  function parseFoldersToGlobs (line 66) | function parseFoldersToGlobs(patterns, extensions = []) {

FILE: test/child-compiler.test.js
  constant PLUGIN_NAME (line 5) | const PLUGIN_NAME = "ChildPlugin";
  class ChildPlugin (line 6) | class ChildPlugin {
    method constructor (line 7) | constructor(options) {
    method apply (line 11) | apply(compiler) {

FILE: test/eslint-lint.test.js
  function ESLint (line 8) | function ESLint() {
  method loadESLint (line 16) | async loadESLint() {

FILE: test/fixtures/cache.js
  function cacheIt (line 5) | function cacheIt() {

FILE: test/fixtures/fixable.js
  function foo (line 1) | function foo() {

FILE: test/fixtures/full-of-problems.js
  function addOne (line 7) | function addOne(i) {

FILE: test/fixtures/good.js
  function test (line 4) | function test() {

FILE: test/fixtures/lint.js
  function test (line 1) | function test() {

FILE: test/fixtures/nonfixable.js
  function foo (line 1) | function foo() {

FILE: test/lint-dirty-modules-only.test.js
  function secondPass (line 30) | function secondPass(err, stats) {
  function firstPass (line 42) | function firstPass(err, stats) {

FILE: test/mock/eslint/index.js
  class ESLintMock (line 1) | class ESLintMock {
    method lintFiles (line 4) | async lintFiles() {
    method loadFormatter (line 26) | async loadFormatter() {

FILE: test/threads.test.js
  method constructor (line 12) | constructor(...args) {

FILE: test/utils.test.js
  method statSync (line 4) | statSync(pattern) {

FILE: test/utils/pack.js
  method runAsync (line 16) | runAsync() {
  method watch (line 27) | watch(options, fn) {

FILE: test/watch.test.js
  function finish (line 44) | function finish(err, stats) {
  function thirdPass (line 51) | function thirdPass(err, stats) {
  function secondPass (line 72) | function secondPass(err, stats) {
  function firstPass (line 93) | function firstPass(err, stats) {

FILE: types/ESLintError.d.ts
  class ESLintError (line 2) | class ESLintError extends Error {

FILE: types/getESLint.d.ts
  type ESLint (line 1) | type ESLint = import("eslint").ESLint;
  type LintResult (line 2) | type LintResult = import("eslint").ESLint.LintResult;
  type Options (line 3) | type Options = import("./options").Options;
  type LintTask (line 4) | type LintTask = (files: string | string[]) => Promise<LintResult[]>;
  type Linter (line 5) | type Linter = {
  type ESLintOptions (line 9) | type ESLintOptions = import("eslint").ESLint.Options;
  type ESLintClass (line 10) | type ESLintClass = {

FILE: types/index.d.ts
  class ESLintWebpackPlugin (line 2) | class ESLintWebpackPlugin {
  type Compiler (line 37) | type Compiler = import("webpack").Compiler;
  type Module (line 38) | type Module = import("webpack").Module;
  type NormalModule (line 39) | type NormalModule = import("webpack").NormalModule;
  type Options (line 40) | type Options = import("./options").Options;

FILE: types/linter.d.ts
  type ESLint (line 30) | type ESLint = import("eslint").ESLint;
  type Formatter (line 31) | type Formatter = import("eslint").ESLint.Formatter;
  type LintResult (line 32) | type LintResult = import("eslint").ESLint.LintResult;
  type Compiler (line 33) | type Compiler = import("webpack").Compiler;
  type Compilation (line 34) | type Compilation = import("webpack").Compilation;
  type Options (line 35) | type Options = import("./options").Options;
  type FormatterFunction (line 36) | type FormatterFunction = import("./options").FormatterFunction;
  type GenerateReport (line 37) | type GenerateReport = (compilation: Compilation) => Promise<void>;
  type Report (line 38) | type Report = {
  type Reporter (line 43) | type Reporter = () => Promise<Report>;
  type Linter (line 44) | type Linter = (files: string | string[]) => void;
  type LintResultMap (line 45) | type LintResultMap = {

FILE: types/options.d.ts
  type ESLintOptions (line 1) | type ESLintOptions = import("eslint").ESLint.Options;
  type LintResult (line 2) | type LintResult = import("eslint").ESLint.LintResult;
  type FormatterFunction (line 3) | type FormatterFunction = (results: LintResult[]) => string;
  type OutputReport (line 4) | type OutputReport = {
  type PluginOptions (line 14) | type PluginOptions = {
  type Options (line 80) | type Options = PluginOptions & ESLintOptions;

FILE: types/utils.d.ts
  type ArrifyResult (line 1) | type ArrifyResult<T> = T extends null | undefined
  type EXPECTED_ANY (line 10) | type EXPECTED_ANY = any;
Condensed preview — 112 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (117K chars).
[
  {
    "path": ".cspell.json",
    "chars": 450,
    "preview": "{\n  \"version\": \"0.2\",\n  \"language\": \"en,en-gb\",\n  \"words\": [\n    \"arrify\",\n    \"notjs\",\n    \"nonfixable\",\n    \"dasdas\",\n"
  },
  {
    "path": ".editorconfig",
    "chars": 195,
    "preview": "# editorconfig.org\n\n[*]\ncharset = utf-8\nindent_style = space\nindent_size = 2\nend_of_line = lf\ninsert_final_newline = tru"
  },
  {
    "path": ".gitattributes",
    "chars": 65,
    "preview": "* text=auto\nbin/* eol=lf\npackage-lock.json -diff\nyarn.lock -diff\n"
  },
  {
    "path": ".github/workflows/dependency-review.yml",
    "chars": 296,
    "preview": "name: \"Dependency Review\"\non: [pull_request]\n\npermissions:\n  contents: read\n\njobs:\n  dependency-review:\n    runs-on: ubu"
  },
  {
    "path": ".github/workflows/nodejs.yml",
    "chars": 2583,
    "preview": "name: eslint-webpack-plugin\n\non:\n  push:\n    branches:\n      - main\n      - next\n  pull_request:\n    branches:\n      - m"
  },
  {
    "path": ".gitignore",
    "chars": 195,
    "preview": "logs\n*.log\nnpm-debug.log*\nyarn-debug.log*\n.eslintcache\n\n/coverage\n/dist\n/local\n/reports\n/node_modules\n/test/outputs\n\n.DS"
  },
  {
    "path": ".prettierignore",
    "chars": 72,
    "preview": "/coverage\n/dist\n/node_modules\n/test/fixtures\n/test/outputs\nCHANGELOG.md\n"
  },
  {
    "path": "CHANGELOG.md",
    "chars": 16650,
    "preview": "# Changelog\n\nAll notable changes to this project will be documented in this file. See [standard-version](https://github."
  },
  {
    "path": "LICENSE",
    "chars": 1071,
    "preview": "Copyright JS Foundation and other contributors\n\nPermission is hereby granted, free of charge, to any person obtaining\na "
  },
  {
    "path": "README.md",
    "chars": 7485,
    "preview": "<div align=\"center\">\n  <a href=\"https://github.com/eslint/eslint\"><img width=\"200\" height=\"200\" src=\"https://cdn.worldve"
  },
  {
    "path": "babel.config.js",
    "chars": 289,
    "preview": "const MIN_BABEL_VERSION = 7;\n\nmodule.exports = (api) => {\n  api.assertVersion(MIN_BABEL_VERSION);\n  api.cache(true);\n\n  "
  },
  {
    "path": "commitlint.config.js",
    "chars": 184,
    "preview": "module.exports = {\n  extends: [\"@commitlint/config-conventional\"],\n  rules: {\n    \"header-max-length\": [0],\n    \"body-ma"
  },
  {
    "path": "eslint.config.mjs",
    "chars": 191,
    "preview": "import { defineConfig } from \"eslint/config\";\nimport configs from \"eslint-config-webpack/configs.js\";\n\nexport default de"
  },
  {
    "path": "husky.config.js",
    "chars": 123,
    "preview": "module.exports = {\n  hooks: {\n    \"pre-commit\": \"lint-staged\",\n    \"commit-msg\": \"commitlint -E HUSKY_GIT_PARAMS\",\n  },\n"
  },
  {
    "path": "jest.config.js",
    "chars": 192,
    "preview": "module.exports = {\n  collectCoverage: true,\n  collectCoverageFrom: [\"src/**/*\"],\n  testEnvironment: \"node\",\n  testTimeou"
  },
  {
    "path": "lint-staged.config.js",
    "chars": 130,
    "preview": "module.exports = {\n  \"*.js\": [\"eslint --fix\", \"prettier --write\", \"cspell\"],\n  \"*.{json,md,yml,css,ts}\": [\"prettier --wr"
  },
  {
    "path": "package.json",
    "chars": 2963,
    "preview": "{\n  \"name\": \"eslint-webpack-plugin\",\n  \"version\": \"6.0.0\",\n  \"description\": \"A ESLint plugin for webpack\",\n  \"keywords\":"
  },
  {
    "path": "src/ESLintError.js",
    "chars": 236,
    "preview": "class ESLintError extends Error {\n  /**\n   * @param {string=} messages messages\n   */\n  constructor(messages) {\n    supe"
  },
  {
    "path": "src/getESLint.js",
    "chars": 1492,
    "preview": "const { getESLintOptions } = require(\"./options\");\n\n/** @typedef {import(\"eslint\").ESLint} ESLint */\n/** @typedef {impor"
  },
  {
    "path": "src/index.js",
    "chars": 5669,
    "preview": "const { isAbsolute, join } = require(\"node:path\");\n\nconst { isMatch } = require(\"micromatch\");\n\nconst linter = require(\""
  },
  {
    "path": "src/linter.js",
    "chars": 7605,
    "preview": "const { dirname, isAbsolute, join } = require(\"node:path\");\n\nconst ESLintError = require(\"./ESLintError\");\nconst { getES"
  },
  {
    "path": "src/options.js",
    "chars": 3383,
    "preview": "const { validate } = require(\"schema-utils\");\n\nconst schema = require(\"./options.json\");\n\n/** @typedef {import(\"eslint\")"
  },
  {
    "path": "src/options.json",
    "chars": 3373,
    "preview": "{\n  \"type\": \"object\",\n  \"additionalProperties\": true,\n  \"properties\": {\n    \"configType\": {\n      \"description\": \"Specif"
  },
  {
    "path": "src/utils.js",
    "chars": 2411,
    "preview": "// eslint-disable-next-line jsdoc/reject-any-type\n/** @typedef {any} EXPECTED_ANY */\n\nconst { statSync } = require(\"node"
  },
  {
    "path": "test/.badeslintrc",
    "chars": 19,
    "preview": "{\n  \"foo\": \"bar\"\n}\n"
  },
  {
    "path": "test/autofix-stop.test.js",
    "chars": 803,
    "preview": "import { join } from \"node:path\";\nimport { copySync, removeSync } from \"fs-extra\";\n\nimport pack from \"./utils/pack\";\n\nde"
  },
  {
    "path": "test/autofix.test.js",
    "chars": 1010,
    "preview": "import { join } from \"node:path\";\n\nimport { copySync, readFileSync, removeSync } from \"fs-extra\";\n\nimport pack from \"./u"
  },
  {
    "path": "test/cached.test.js",
    "chars": 1101,
    "preview": "import { join } from \"node:path\";\n\nimport { removeSync } from \"fs-extra\";\n\nimport webpack from \"webpack\";\n\nimport conf f"
  },
  {
    "path": "test/child-compiler.test.js",
    "chars": 1063,
    "preview": "import webpack from \"webpack\";\n\nimport conf from \"./utils/conf\";\n\nconst PLUGIN_NAME = \"ChildPlugin\";\nclass ChildPlugin {"
  },
  {
    "path": "test/circular-plugin.test.js",
    "chars": 696,
    "preview": "import pack from \"./utils/pack\";\n\ndescribe(\"circular plugin\", () => {\n  it(\"should support plugins with circular configs"
  },
  {
    "path": "test/config-for-tests/.eslintrc.js",
    "chars": 528,
    "preview": "module.exports = {\n  ignorePatterns: [\"**/ignore.js\"],\n  globals: {\n    __dirname: \"readonly\",\n    __filename: \"readonly"
  },
  {
    "path": "test/config-for-tests/eslint.config.mjs",
    "chars": 334,
    "preview": "import { defineConfig } from \"eslint/config\";\nimport globals from \"globals\";\n\nexport default defineConfig({\n  languageOp"
  },
  {
    "path": "test/context.test.js",
    "chars": 585,
    "preview": "import { join } from \"node:path\";\n\nimport pack from \"./utils/pack\";\n\ndescribe(\"context\", () => {\n  it(\"absolute\", async "
  },
  {
    "path": "test/emit-error.test.js",
    "chars": 1366,
    "preview": "import pack from \"./utils/pack\";\n\ndescribe(\"emit error\", () => {\n  it(\"should not emit errors if emitError is false\", as"
  },
  {
    "path": "test/emit-warning.test.js",
    "chars": 1391,
    "preview": "import pack from \"./utils/pack\";\n\ndescribe(\"emit warning\", () => {\n  it(\"should not emit warnings if emitWarning is fals"
  },
  {
    "path": "test/empty.test.js",
    "chars": 517,
    "preview": "import { join } from \"node:path\";\n\nimport webpack from \"webpack\";\n\nimport ESLintPlugin from \"../src\";\n\ndescribe(\"empty\","
  },
  {
    "path": "test/error.test.js",
    "chars": 766,
    "preview": "import pack from \"./utils/pack\";\n\ndescribe(\"error\", () => {\n  afterEach(() => {\n    jest.restoreAllMocks();\n  });\n\n  it("
  },
  {
    "path": "test/eslint-lint.test.js",
    "chars": 1273,
    "preview": "import pack from \"./utils/pack\";\n\ndescribe(\"eslint lint\", () => {\n  const mockLintFiles = jest.fn().mockReturnValue([]);"
  },
  {
    "path": "test/eslint-options.test.js",
    "chars": 790,
    "preview": "import { getESLintOptions } from \"../src/options\";\n\ndescribe(\"eslint options\", () => {\n  it(\"should filter loader option"
  },
  {
    "path": "test/eslint-path.test.js",
    "chars": 505,
    "preview": "import { join } from \"node:path\";\n\nimport pack from \"./utils/pack\";\n\ndescribe(\"eslint path\", () => {\n  it(\"should use an"
  },
  {
    "path": "test/eslintrc-config.test.js",
    "chars": 929,
    "preview": "import { join } from \"node:path\";\n\nimport { ESLint } from \"eslint\";\nimport pack from \"./utils/pack\";\n\n(ESLint && Number."
  },
  {
    "path": "test/exclude.test.js",
    "chars": 823,
    "preview": "import pack from \"./utils/pack\";\n\ndescribe(\"exclude\", () => {\n  it(\"should exclude with globs\", async () => {\n    const "
  },
  {
    "path": "test/fail-on-config.test.js",
    "chars": 887,
    "preview": "import { join } from \"node:path\";\n\nimport { ESLint } from \"eslint\";\nimport pack from \"./utils/pack\";\n\n(ESLint && Number."
  },
  {
    "path": "test/fail-on-error.test.js",
    "chars": 670,
    "preview": "import pack from \"./utils/pack\";\n\ndescribe(\"fail on error\", () => {\n  it(\"should emits errors\", async () => {\n    const "
  },
  {
    "path": "test/fail-on-warning.test.js",
    "chars": 465,
    "preview": "import pack from \"./utils/pack\";\n\ndescribe(\"fail on warning\", () => {\n  it(\"should emits errors\", async () => {\n    cons"
  },
  {
    "path": "test/fixtures/[symbols]/error.js",
    "chars": 16,
    "preview": "var foo = stuff\n"
  },
  {
    "path": "test/fixtures/[symbols]/symbols-entry.js",
    "chars": 20,
    "preview": "require('./error');\n"
  },
  {
    "path": "test/fixtures/cache.js",
    "chars": 87,
    "preview": "\"use strict\"\n\nrequire(\"./require\")\n\nfunction cacheIt() {\n  return \"cache\"\n}\n\ncacheIt()\n"
  },
  {
    "path": "test/fixtures/child-entry.js",
    "chars": 42,
    "preview": "console.log(\"Hello from child-entry.js\");\n"
  },
  {
    "path": "test/fixtures/error-entry.js",
    "chars": 20,
    "preview": "require('./error');\n"
  },
  {
    "path": "test/fixtures/error-warn-entry.js",
    "chars": 39,
    "preview": "require('./error');\nrequire('./warn');\n"
  },
  {
    "path": "test/fixtures/error.js",
    "chars": 16,
    "preview": "var foo = stuff\n"
  },
  {
    "path": "test/fixtures/eslintrc-config.js",
    "chars": 228,
    "preview": "module.exports = {\n  root: true,\n  parserOptions: {\n    ecmaVersion: 2018,\n    env: {\n      es6: true,\n      jest: true,"
  },
  {
    "path": "test/fixtures/exclude-entry.js",
    "chars": 19,
    "preview": "require(\"./error\")\n"
  },
  {
    "path": "test/fixtures/exclude-folder-entry.js",
    "chars": 26,
    "preview": "require(\"./folder/error\")\n"
  },
  {
    "path": "test/fixtures/fixable-clone-entry.js",
    "chars": 28,
    "preview": "require('./fixable-clone');\n"
  },
  {
    "path": "test/fixtures/fixable.js",
    "chars": 40,
    "preview": "function foo() {\n  return true\n}\n\nfoo()\n"
  },
  {
    "path": "test/fixtures/flat-config.js",
    "chars": 78,
    "preview": "\nmodule.exports = [\n    {\n        files: [\"*.js\"],\n        rules: {}\n    }\n];\n"
  },
  {
    "path": "test/fixtures/folder/error.js",
    "chars": 16,
    "preview": "var foo = stuff\n"
  },
  {
    "path": "test/fixtures/folder/readme.md",
    "chars": 58,
    "preview": "This folder is used as a fixture for dirty file watching.\n"
  },
  {
    "path": "test/fixtures/full-of-problems-entry.js",
    "chars": 30,
    "preview": "require('./full-of-problems');"
  },
  {
    "path": "test/fixtures/full-of-problems.js",
    "chars": 269,
    "preview": "/* eslint consistent-return: \"error\" */\n/* eslint indent: [\"warn\", 4] */\n/* eslint no-else-return: \"warn\" */\n/* eslint s"
  },
  {
    "path": "test/fixtures/good-entry.js",
    "chars": 19,
    "preview": "require(\"./good\");\n"
  },
  {
    "path": "test/fixtures/good.js",
    "chars": 80,
    "preview": "/**\n * @returns {string} value\n */\nfunction test() {\n  return \"value\"\n}\n\ntest()\n"
  },
  {
    "path": "test/fixtures/ignore-entry.js",
    "chars": 21,
    "preview": "require('./ignore');\n"
  },
  {
    "path": "test/fixtures/ignore.js",
    "chars": 87,
    "preview": "// this file should be totally ignore since it's present in .eslintignore\nvar -dasdas;\n"
  },
  {
    "path": "test/fixtures/index.js",
    "chars": 20,
    "preview": "module.exports = {}\n"
  },
  {
    "path": "test/fixtures/lint-more-entry.js",
    "chars": 23,
    "preview": "require('./lint-more')\n"
  },
  {
    "path": "test/fixtures/lint-more.js",
    "chars": 18,
    "preview": "require('./lint')\n"
  },
  {
    "path": "test/fixtures/lint-one-entry.js",
    "chars": 3,
    "preview": "//\n"
  },
  {
    "path": "test/fixtures/lint-two-entry.js",
    "chars": 44,
    "preview": "require('./lint')\nrequire('./lint?foo=bar')\n"
  },
  {
    "path": "test/fixtures/lint.js",
    "chars": 45,
    "preview": "function test() {\n  return \"value\"\n}\n\ntest()\n"
  },
  {
    "path": "test/fixtures/multiple-entry.js",
    "chars": 39,
    "preview": "require(\"./good\");\nrequire(\"./error\");\n"
  },
  {
    "path": "test/fixtures/nonfixable-clone-entry.js",
    "chars": 31,
    "preview": "require('./nonfixable-clone');\n"
  },
  {
    "path": "test/fixtures/nonfixable.js",
    "chars": 43,
    "preview": "function foo() {\n  return stuff;\n}\n\nfoo();\n"
  },
  {
    "path": "test/fixtures/query-entry.js",
    "chars": 176,
    "preview": "// disable: eslint-disable-next-line import/no-unresolved\nrequire('./good?some-query=1234');\n// disable: eslint-disable-"
  },
  {
    "path": "test/fixtures/require.js",
    "chars": 31,
    "preview": "\"use strict\"\n\nrequire(\"./good\")"
  },
  {
    "path": "test/fixtures/resource-query-entry.js",
    "chars": 98,
    "preview": "// disable: eslint-disable-next-line import/no-unresolved\nrequire('./media/some-video.ts?media');\n"
  },
  {
    "path": "test/fixtures/warn-entry.js",
    "chars": 19,
    "preview": "require('./warn');\n"
  },
  {
    "path": "test/fixtures/warn-error-entry.js",
    "chars": 39,
    "preview": "require('./warn');\nrequire('./error');\n"
  },
  {
    "path": "test/fixtures/warn.js",
    "chars": 51,
    "preview": "/* eslint no-unused-vars: warn */\nconst foo = this\n"
  },
  {
    "path": "test/flat-config.test.js",
    "chars": 652,
    "preview": "import { join } from \"node:path\";\nimport pack from \"./utils/pack\";\n\ndescribe(\"succeed on flat-configuration\", () => {\n  "
  },
  {
    "path": "test/formatter-custom.test.js",
    "chars": 1187,
    "preview": "import pack from \"./utils/pack\";\n\ndescribe(\"formatter eslint\", () => {\n  it(\"should use custom formatter as function\", a"
  },
  {
    "path": "test/formatter-eslint.test.js",
    "chars": 362,
    "preview": "import pack from \"./utils/pack\";\n\ndescribe(\"formatter eslint\", () => {\n  it(\"should use eslint formatter\", async () => {"
  },
  {
    "path": "test/formatter-official.test.js",
    "chars": 389,
    "preview": "import pack from \"./utils/pack\";\n\ndescribe(\"formatter official\", () => {\n  it(\"should use official formatter\", async () "
  },
  {
    "path": "test/formatter-write.test.js",
    "chars": 1673,
    "preview": "import { join } from \"node:path\";\n\nimport { readFileSync, removeSync } from \"fs-extra\";\nimport webpack from \"webpack\";\n\n"
  },
  {
    "path": "test/ignore.test.js",
    "chars": 491,
    "preview": "import ESLintError from \"../src/ESLintError\";\nimport pack from \"./utils/pack\";\n\ndescribe(\"eslintignore\", () => {\n  it(\"s"
  },
  {
    "path": "test/lint-dirty-modules-only.test.js",
    "chars": 1361,
    "preview": "import { writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nimport { removeSync } from \"fs-extra\";\n\nimpo"
  },
  {
    "path": "test/mock/eslint/index.js",
    "chars": 721,
    "preview": "class ESLintMock {\n  // Disabled because these are simplified mock methods.\n\n  async lintFiles() {\n    return [\n      {\n"
  },
  {
    "path": "test/mock/eslint/package.json",
    "chars": 45,
    "preview": "{\n  \"name\": \"eslint\",\n  \"version\": \"7.0.0\"\n}\n"
  },
  {
    "path": "test/mock/formatter/index.js",
    "chars": 115,
    "preview": "module.exports = function format(results) {\n  return JSON.stringify({\n    formatter: \"mock\",\n    results,\n  });\n};\n"
  },
  {
    "path": "test/multiple-instances.test.js",
    "chars": 2502,
    "preview": "import { join } from \"node:path\";\nimport ESLintPlugin from \"../src\";\nimport pack from \"./utils/pack\";\n\ndescribe(\"multipl"
  },
  {
    "path": "test/ok.test.js",
    "chars": 297,
    "preview": "import pack from \"./utils/pack\";\n\ndescribe(\"ok\", () => {\n  it(\"should don't throw error if file is ok\", async () => {\n  "
  },
  {
    "path": "test/parameters.test.js",
    "chars": 418,
    "preview": "import pack from \"./utils/pack\";\n\ndescribe(\"parameters\", () => {\n  it(\"should supports query strings parameters\", async "
  },
  {
    "path": "test/query.test.js",
    "chars": 448,
    "preview": "import pack from \"./utils/pack\";\n\ndescribe(\"query\", () => {\n  it(\"should correctly resolve file despite query path\", asy"
  },
  {
    "path": "test/quiet.test.js",
    "chars": 603,
    "preview": "import pack from \"./utils/pack\";\n\ndescribe(\"quiet\", () => {\n  it(\"should not emit warnings if quiet is set\", async () =>"
  },
  {
    "path": "test/resource-query.test.js",
    "chars": 521,
    "preview": "import pack from \"./utils/pack\";\n\ndescribe(\"resource-query\", () => {\n  it(\"should exclude the match resource query\", asy"
  },
  {
    "path": "test/symbols.test.js",
    "chars": 456,
    "preview": "import { join } from \"node:path\";\n\nimport pack from \"./utils/pack\";\n\ndescribe(\"symbols\", () => {\n  afterEach(() => {\n   "
  },
  {
    "path": "test/threads.test.js",
    "chars": 1021,
    "preview": "import workerThreads from \"node:worker_threads\";\nimport pack from \"./utils/pack\";\n\ndescribe(\"Multithread\", () => {\n  let"
  },
  {
    "path": "test/utils/conf.js",
    "chars": 812,
    "preview": "import { join } from \"node:path\";\nimport ESLintPlugin from \"../../src\";\n\nexport default (entry, pluginConf = {}, webpack"
  },
  {
    "path": "test/utils/pack.js",
    "chars": 802,
    "preview": "import webpack from \"webpack\";\n\nimport conf from \"./conf\";\n\n/**\n * new a test webpack compiler\n * @param {string} contex"
  },
  {
    "path": "test/utils.test.js",
    "chars": 1815,
    "preview": "import { parseFiles, parseFoldersToGlobs } from \"../src/utils\";\n\njest.mock(\"fs\", () => ({\n  statSync(pattern) {\n    retu"
  },
  {
    "path": "test/warning.test.js",
    "chars": 283,
    "preview": "import pack from \"./utils/pack\";\n\ndescribe(\"warning\", () => {\n  it(\"should emit warnings\", async () => {\n    const compi"
  },
  {
    "path": "test/watch.test.js",
    "chars": 3309,
    "preview": "import { writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nimport { removeSync } from \"fs-extra\";\n\nimpo"
  },
  {
    "path": "tsconfig.json",
    "chars": 272,
    "preview": "{\n  \"compilerOptions\": {\n    \"target\": \"esnext\",\n    \"moduleResolution\": \"node\",\n    \"allowJs\": true,\n    \"checkJs\": tru"
  },
  {
    "path": "types/ESLintError.d.ts",
    "chars": 181,
    "preview": "export = ESLintError;\ndeclare class ESLintError extends Error {\n  /**\n   * @param {string=} messages messages\n   */\n  co"
  },
  {
    "path": "types/getESLint.d.ts",
    "chars": 1122,
    "preview": "export type ESLint = import(\"eslint\").ESLint;\nexport type LintResult = import(\"eslint\").ESLint.LintResult;\nexport type O"
  },
  {
    "path": "types/index.d.ts",
    "chars": 1180,
    "preview": "export = ESLintWebpackPlugin;\ndeclare class ESLintWebpackPlugin {\n  /**\n   * @param {Options=} options options\n   */\n  c"
  },
  {
    "path": "types/linter.d.ts",
    "chars": 1274,
    "preview": "export = linter;\n/**\n * @param {Options} options options\n * @param {Compilation} compilation compilation\n * @returns {Pr"
  },
  {
    "path": "types/options.d.ts",
    "chars": 4361,
    "preview": "export type ESLintOptions = import(\"eslint\").ESLint.Options;\nexport type LintResult = import(\"eslint\").ESLint.LintResult"
  },
  {
    "path": "types/utils.d.ts",
    "chars": 1068,
    "preview": "export type ArrifyResult<T> = T extends null | undefined\n  ? []\n  : T extends string\n    ? [string]\n    : T extends read"
  }
]

// ... and 1 more files (download for full content)

About this extraction

This page contains the full source code of the webpack-contrib/eslint-webpack-plugin GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 112 files (103.0 KB), approximately 29.8k tokens, and a symbol index with 82 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!