Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: eslint/eslint
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v8.43.0
Choose a base ref
...
head repository: eslint/eslint
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v8.44.0
Choose a head ref

Commits on Jun 20, 2023

  1. docs: Update README

    GitHub Actions Bot committed Jun 20, 2023
    1
    Copy the full SHA
    19a8c5d View commit details
  2. docs: Integration section and tutorial (#17132)

    * docs: Integration section and tutorial
    
    * add navigation and landing pages for integration section
    
    * copy edits
    
    * working sample rule
    
    * complete integration tutorial draft
    
    * remove TODO
    
    * Apply suggestions from code review
    
    Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
    
    * update source code
    
    * update tutorial
    
    * copy / linting edits
    
    * lint fix
    
    * Apply suggestions from code review
    
    Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
    
    * implement nz feedback
    
    * Copy edit
    
    * Apply suggestions from code review
    
    Co-authored-by: Nitin Kumar <snitin315@gmail.com>
    
    * Apply suggestions from code review
    
    Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
    
    * Apply suggestions from code review
    
    Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
    
    * implement MD feedback
    
    * copy edit
    
    ---------
    
    Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
    Co-authored-by: Nitin Kumar <snitin315@gmail.com>
    Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
    4 people authored Jun 20, 2023
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e1314bf View commit details
  3. 1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    391ed38 View commit details
  4. chore: switch eslint-config-eslint to the flat format (#17247)

    * chore: switch eslint-config-eslint to the flat format
    
    1. convert eslint-config-eslint to the flat format.
    2. export eslint-config-eslint/eslintrc (used by testing).
    3. upgrade `eslint-plugin-n` v16 (added flat config supports).
    4. change eslint plugins peerDependencies => dependencies.
    5. change lib/eslint/eslint.js, lib/eslint/flat-eslint.js test cases
    to make the ci happy.
    
    note: it's a breaking change for eslint-config-eslint.
    
    refs: https://eslint.org/docs/latest/use/configure/configuration-files-new
    
    * fix: add linterOptions
    
    * chore: update comments as .eslintrc.js is no longer needed for testing
    aladdin-add authored Jun 20, 2023
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b991640 View commit details

Commits on Jun 21, 2023

  1. 1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    526e911 View commit details
  2. chore: update eslint-plugin-jsdoc to 46.2.5 (#17245)

    1. Removes `jsdoc/newline-after-description` rule in favor of `jsdoc/tag-lines`
    with option `startLines: 0` for "never" and `startLines: 1` for "always".
    Refs: https://github.com/gajus/eslint-plugin-jsdoc/releases/tag/v42.0.0
    
    2. disabled rule jsdoc/no-defaults: it's a new added rule in its recommended config
     that eslint does not follow.
    
    3. disabled rule jsdoc/check-line-alignment: I've tried its option "never"|"always"|"any"
    - none of them fully meet our needs.
    aladdin-add authored Jun 21, 2023
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    da81e66 View commit details

Commits on Jun 22, 2023

  1. perf: various performance improvements (#17135)

    * perf: addParensIndent replaced shifting with reverse iteration
    
    * perf: changed string handling from regex to manual parsing
    
    * refactor: more explicit
    
    * perf: remove unnessisary array and object creation
    
    * pref: opimized out reduce for basic iteration
    
    * perf: replaced reduce with basic iteration
    
    * perf: optimized unessisary array creation and objects
    
    * perf: replaced reduce with basic iteration
    
    * perf: replaced reduce with basic iteration
    
    * perf: replaced filter with basic loop for counting valid elements
    
    * perf: removed array creation in indent program exit
    moonlightaria authored Jun 22, 2023
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f82e56e View commit details
  2. feat: allow flat config files to export a Promise (#17301)

    * feat: allow flat config files to export a Promise
    
    Fixes #16864, #16580
    
    * Update docs/src/use/configure/configuration-files-new.md
    
    Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
    
    * Update docs/src/use/configure/configuration-files-new.md
    
    Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
    
    ---------
    
    Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
    mdjermanovic and nzakas authored Jun 22, 2023
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    1866e1d View commit details

Commits on Jun 25, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    9718a97 View commit details

Commits on Jun 28, 2023

  1. feat: treat unknown nodes as having the lowest precedence (#17302)

    * feat: treat unknown nodes as having the lowest precedence
    
    * fix test typo
    
    * more tests and handle prefer-exponentiation case
    
    * review fixes and more cases
    
    * Apply suggestions from code review
    
    Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
    
    ---------
    
    Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
    bradzacher and mdjermanovic authored Jun 28, 2023
    2

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ef6e24e View commit details
  2. 2

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7620b89 View commit details
  3. 1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    cf88439 View commit details
  4. feat: Move parserServices to SourceCode (#17311)

    Deprecates `context.parserServices` in favor of `SourceCode#parserServices`
    
    Refs #16999
    mdjermanovic authored Jun 28, 2023
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c8b1f4d View commit details

Commits on Jun 30, 2023

  1. fix: no-unused-vars false positive with logical assignment operators (#…

    …17320)
    
    * fix: no-unused-vars should be corrected in logical assignment operator
    
    Fixes #17299
    
    * refactor: use astUtils.isLogicalAssignmentOperator check exception
    gweesin authored Jun 30, 2023
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a36bcb6 View commit details
  2. 1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    eb3d794 View commit details
  3. chore: package.json update for eslint-config-eslint release

    ESLint Jenkins committed Jun 30, 2023
    1
    Copy the full SHA
    e6e74f9 View commit details
  4. test: More test cases for no-case-declarations (#17315)

    * feat: Added more no-case-declarations tests
    
    * Fix: Removed parserOptions
    ElianCordoba authored Jun 30, 2023
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    840a264 View commit details
  5. feat: add ternaryOperandBinaryExpressions option to no-extra-parens r…

    …ule (#17270)
    
    * feat: add `conditionalTernary` option to `no-extra-parens` rule
    
    * chore: improve coverage
    
    * chore: improve coverage
    
    * chore: avoid SequenceExpression miss
    
    * chore: change option name to ternaryOperandBinaryExpressions
    
    * docs: update docs
    
    * docs: fix space inside code
    
    * chore: update
    
    * chore: clean
    
    * docs: update
    
    * chore: update
    kecrily authored Jun 30, 2023
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4d411e4 View commit details
  6. feat: add ecmaVersion: 2024, regexp v flag parsing (#17324)

    * feat: add `ecmaVersion: 2024`, regexp `v` flag parsing
    
    * Update package.json
    mdjermanovic authored Jun 30, 2023
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    4c50400 View commit details
  7. feat: add es2023 and es2024 environments (#17328)

    * feat: add `es2023` and `es2024` environments
    
    Fixes #17298
    
    * Update package.json
    mdjermanovic authored Jun 30, 2023
    1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    1766771 View commit details
  8. chore: package.json update for @eslint/js release

    ESLint Jenkins committed Jun 30, 2023
    1
    Copy the full SHA
    a1cb642 View commit details
  9. 1

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    49e46ed View commit details
  10. Build: changelog update for 8.44.0

    ESLint Jenkins committed Jun 30, 2023
    1
    Copy the full SHA
    849933b View commit details
  11. 8.44.0

    ESLint Jenkins committed Jun 30, 2023
    1
    Copy the full SHA
    8c1ec65 View commit details
Showing with 6,130 additions and 773 deletions.
  1. +2 −3 .eslintrc.js
  2. +25 −0 CHANGELOG.md
  3. +2 −2 README.md
  4. +6 −1 conf/globals.js
  5. +2 −0 docs/_examples/integration-tutorial-code/.gitignore
  6. +62 −0 docs/_examples/integration-tutorial-code/example-eslint-integration.js
  7. +27 −0 docs/_examples/integration-tutorial-code/example-eslint-integration.test.js
  8. +15 −0 docs/_examples/integration-tutorial-code/package.json
  9. +29 −0 docs/_examples/integration-tutorial-code/sample-data/test-file.js
  10. +1 −1 docs/package.json
  11. +1 −1 docs/src/contribute/index.md
  12. +2 −2 docs/src/extend/custom-parsers.md
  13. +12 −8 docs/src/extend/custom-rules.md
  14. +0 −4 docs/src/extend/index.md
  15. +25 −0 docs/src/integrate/index.md
  16. +236 −0 docs/src/integrate/integration-tutorial.md
  17. +2 −2 docs/src/integrate/nodejs-api.md
  18. +1 −1 docs/src/maintain/index.md
  19. +5 −1 docs/src/pages/index.md
  20. +21 −0 docs/src/rules/no-extra-parens.md
  21. +2 −0 docs/src/rules/no-extra-semi.md
  22. +2 −0 docs/src/rules/no-unused-labels.md
  23. +28 −1 docs/src/use/configure/configuration-files-new.md
  24. +3 −1 docs/src/use/configure/language-options.md
  25. +1 −1 docs/src/use/formatters/html-formatter-example.html
  26. +2 −8 eslint.config.js
  27. +27 −18 lib/cli-engine/cli-engine.js
  28. +15 −109 lib/eslint/flat-eslint.js
  29. +1 −2 lib/rule-tester/flat-rule-tester.js
  30. +1 −2 lib/rule-tester/rule-tester.js
  31. +33 −41 lib/rules/accessor-pairs.js
  32. +10 −4 lib/rules/array-element-newline.js
  33. +1 −2 lib/rules/dot-notation.js
  34. +33 −42 lib/rules/grouped-accessor-pairs.js
  35. +43 −31 lib/rules/indent.js
  36. +5 −2 lib/rules/logical-assignment-operators.js
  37. +17 −13 lib/rules/max-len.js
  38. +12 −2 lib/rules/no-extra-parens.js
  39. +29 −11 lib/rules/no-extra-semi.js
  40. +14 −6 lib/rules/no-loss-of-precision.js
  41. +7 −10 lib/rules/no-restricted-modules.js
  42. +46 −13 lib/rules/no-unused-labels.js
  43. +2 −1 lib/rules/no-unused-vars.js
  44. +2 −1 lib/rules/prefer-exponentiation-operator.js
  45. +3 −12 lib/rules/prefer-regex-literals.js
  46. +20 −1 lib/rules/utils/ast-utils.js
  47. +7 −1 lib/rules/valid-typeof.js
  48. +2 −11 lib/rules/yoda.js
  49. +1 −1 lib/shared/types.js
  50. +8 −8 package.json
  51. +4 −5 packages/eslint-config-eslint/README.md
  52. +0 −340 packages/eslint-config-eslint/default.yml
  53. +453 −0 packages/eslint-config-eslint/eslintrc.js
  54. +398 −7 packages/eslint-config-eslint/index.js
  55. +7 −6 packages/eslint-config-eslint/package.json
  56. +1 −1 packages/js/package.json
  57. +333 −0 tests/fixtures/parsers/typescript-parsers/boolean-cast-with-assertion.js
  58. +321 −0 tests/fixtures/parsers/typescript-parsers/exponentiation-with-assertion-1.js
  59. +321 −0 tests/fixtures/parsers/typescript-parsers/exponentiation-with-assertion-2.js
  60. +321 −0 tests/fixtures/parsers/typescript-parsers/exponentiation-with-assertion-3.js
  61. +209 −0 tests/fixtures/parsers/typescript-parsers/logical-assignment-with-assertion.js
  62. +538 −0 tests/fixtures/parsers/typescript-parsers/logical-with-assignment-with-assertion-1.js
  63. +568 −0 tests/fixtures/parsers/typescript-parsers/logical-with-assignment-with-assertion-2.js
  64. +568 −0 tests/fixtures/parsers/typescript-parsers/logical-with-assignment-with-assertion-3.js
  65. +366 −0 tests/fixtures/parsers/typescript-parsers/member-call-expr-with-assertion.js
  66. +238 −0 tests/fixtures/parsers/typescript-parsers/unneeded-ternary-1.js
  67. +240 −0 tests/fixtures/parsers/typescript-parsers/unneeded-ternary-2.js
  68. +1 −0 tests/fixtures/promise-config/a.js
  69. +5 −0 tests/fixtures/promise-config/eslint.config.js
  70. +4 −4 tests/lib/cli-engine/cli-engine.js
  71. +13 −8 tests/lib/eslint/eslint.js
  72. +36 −7 tests/lib/eslint/flat-eslint.js
  73. +9 −5 tests/lib/linter/linter.js
  74. +3 −1 tests/lib/rule-tester/flat-rule-tester.js
  75. +3 −1 tests/lib/rule-tester/rule-tester.js
  76. +58 −2 tests/lib/rules/logical-assignment-operators.js
  77. +34 −1 tests/lib/rules/no-case-declarations.js
  78. +11 −1 tests/lib/rules/no-extra-boolean-cast.js
  79. +20 −1 tests/lib/rules/no-extra-parens.js
  80. +37 −0 tests/lib/rules/no-extra-semi.js
  81. +25 −1 tests/lib/rules/no-unneeded-ternary.js
  82. +63 −0 tests/lib/rules/no-unused-labels.js
  83. +14 −0 tests/lib/rules/no-unused-vars.js
  84. +37 −1 tests/lib/rules/prefer-exponentiation-operator.js
  85. +18 −0 tests/lib/rules/utils/ast-utils.js
5 changes: 2 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -6,8 +6,7 @@
* Internally, ESLint is using the eslint.config.js file to lint itself.
* This file is needed too, because:
*
* 1. There are tests that expect .eslintrc.js to be present to actually run.
* 2. ESLint VS Code extension expects eslintrc config files to be
* 1. ESLint VS Code extension expects eslintrc config files to be
* present to work correctly.
*
* Once we no longer need to support both eslintrc and flat config, we will
@@ -63,7 +62,7 @@ module.exports = {
"internal-rules"
],
extends: [
"eslint"
"eslint/eslintrc"
],
parserOptions: {
ecmaVersion: 2021
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
v8.44.0 - June 30, 2023

* [`49e46ed`](https://github.com/eslint/eslint/commit/49e46edf3c8dc71d691a97fc33b63ed80ae0db0c) chore: upgrade @eslint/js@8.44.0 (#17329) (Milos Djermanovic)
* [`a1cb642`](https://github.com/eslint/eslint/commit/a1cb6421f9d185901cd99e5f696e912226ef6632) chore: package.json update for @eslint/js release (ESLint Jenkins)
* [`1766771`](https://github.com/eslint/eslint/commit/176677180a4a1209fc192771521c9192e1f67578) feat: add `es2023` and `es2024` environments (#17328) (Milos Djermanovic)
* [`4c50400`](https://github.com/eslint/eslint/commit/4c5040022639ae804c15b366afc6e64982bd8ae3) feat: add `ecmaVersion: 2024`, regexp `v` flag parsing (#17324) (Milos Djermanovic)
* [`4d411e4`](https://github.com/eslint/eslint/commit/4d411e4c7063274d6d346f1b7ee46f7575d0bbd2) feat: add ternaryOperandBinaryExpressions option to no-extra-parens rule (#17270) (Percy Ma)
* [`840a264`](https://github.com/eslint/eslint/commit/840a26462bbf6c27c52c01b85ee2018062157951) test: More test cases for no-case-declarations (#17315) (Elian Cordoba)
* [`e6e74f9`](https://github.com/eslint/eslint/commit/e6e74f9eef0448129dd4775628aba554a2d8c8c9) chore: package.json update for eslint-config-eslint release (ESLint Jenkins)
* [`eb3d794`](https://github.com/eslint/eslint/commit/eb3d7946e1e9f70254008744dba2397aaa730114) chore: upgrade semver@7.5.3 (#17323) (Ziyad El Abid)
* [`a36bcb6`](https://github.com/eslint/eslint/commit/a36bcb67f26be42c794797d0cc9948b9cfd4ff71) fix: no-unused-vars false positive with logical assignment operators (#17320) (Gweesin Chan)
* [`c8b1f4d`](https://github.com/eslint/eslint/commit/c8b1f4d61a256727755d561bf53f889b6cd712e0) feat: Move `parserServices` to `SourceCode` (#17311) (Milos Djermanovic)
* [`cf88439`](https://github.com/eslint/eslint/commit/cf884390ad8071d88eae05df9321100f1770363d) chore: upgrade optionator@0.9.3 (#17319) (Milos Djermanovic)
* [`7620b89`](https://github.com/eslint/eslint/commit/7620b891e81c234f30f9dbcceb64a05fd0dde65e) fix: Remove `no-unused-labels` autofix before potential directives (#17314) (Francesco Trotta)
* [`ef6e24e`](https://github.com/eslint/eslint/commit/ef6e24e42670f321d996948623846d9caaedac99) feat: treat unknown nodes as having the lowest precedence (#17302) (Brad Zacher)
* [`9718a97`](https://github.com/eslint/eslint/commit/9718a9781d69d2c40b68c631aed97700b32c0082) refactor: remove unnecessary code in `flat-eslint.js` (#17308) (Milos Djermanovic)
* [`1866e1d`](https://github.com/eslint/eslint/commit/1866e1df6175e4ba0ae4a0d88dc3c956bb310035) feat: allow flat config files to export a Promise (#17301) (Milos Djermanovic)
* [`f82e56e`](https://github.com/eslint/eslint/commit/f82e56e9acfb9562ece76441472d5657d7d5e296) perf: various performance improvements (#17135) (moonlightaria)
* [`da81e66`](https://github.com/eslint/eslint/commit/da81e66e22b4f3d3fe292cf70c388753304deaad) chore: update eslint-plugin-jsdoc to 46.2.5 (#17245) (唯然)
* [`526e911`](https://github.com/eslint/eslint/commit/526e91106e6fe101578e9478a9d7f4844d4f72ac) docs: resubmit pr 17115 doc changes (#17291) (唯然)
* [`b991640`](https://github.com/eslint/eslint/commit/b991640176d5dce4750f7cc71c56cd6f284c882f) chore: switch eslint-config-eslint to the flat format (#17247) (唯然)
* [`391ed38`](https://github.com/eslint/eslint/commit/391ed38b09bd1a3abe85db65b8fcda980ab3d6f4) fix: Remove `no-extra-semi` autofix before potential directives (#17297) (Francesco Trotta)
* [`e1314bf`](https://github.com/eslint/eslint/commit/e1314bf85a52bb0d05b1c9ca3b4c1732bae22172) docs: Integration section and tutorial (#17132) (Ben Perlmutter)
* [`19a8c5d`](https://github.com/eslint/eslint/commit/19a8c5d84596a9f7f2aa428c1696ba86daf854e6) docs: Update README (GitHub Actions Bot)

v8.43.0 - June 16, 2023

* [`78350f6`](https://github.com/eslint/eslint/commit/78350f63045c82b7990bb7bfe5080c5ad5e1c3f5) chore: upgrade @eslint/js@8.43.0 (#17295) (Milos Djermanovic)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -117,7 +117,7 @@ Yes, ESLint natively supports parsing JSX syntax (this must be enabled in [confi

### What ECMAScript versions does ESLint support?

ESLint has full support for ECMAScript 3, 5 (default), 2015, 2016, 2017, 2018, 2019, 2020, 2021 and 2022. You can set your desired ECMAScript syntax (and other settings, like global variables or your target environments) through [configuration](https://eslint.org/docs/latest/use/configure).
ESLint has full support for ECMAScript 3, 5 (default), 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, and 2023. You can set your desired ECMAScript syntax (and other settings, like global variables or your target environments) through [configuration](https://eslint.org/docs/latest/use/configure).

### What about experimental features?

@@ -284,7 +284,7 @@ The following companies, organizations, and individuals support ESLint's ongoing
<p><a href="#"><img src="https://images.opencollective.com/2021-frameworks-fund/logo.png" alt="Chrome Frameworks Fund" height="undefined"></a> <a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="undefined"></a></p><h3>Gold Sponsors</h3>
<p><a href="https://engineering.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="96"></a></p><h3>Silver Sponsors</h3>
<p><a href="https://sentry.io"><img src="https://avatars.githubusercontent.com/u/1396951?v=4" alt="Sentry" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a></p><h3>Bronze Sponsors</h3>
<p><a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://nx.dev"><img src="https://images.opencollective.com/nx/0efbe42/logo.png" alt="Nx (by Nrwl)" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8: free icons, photos, illustrations, and music" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://transloadit.com/"><img src="https://avatars.githubusercontent.com/u/125754?v=4" alt="Transloadit" height="32"></a> <a href="https://www.ignitionapp.com"><img src="https://avatars.githubusercontent.com/u/5753491?v=4" alt="Ignition" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a> <a href="https://quickbookstoolhub.com"><img src="https://avatars.githubusercontent.com/u/95090305?u=e5bc398ef775c9ed19f955c675cdc1fb6abf01df&v=4" alt="QuickBooks Tool hub" height="32"></a></p>
<p><a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/d5592fe/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://nx.dev"><img src="https://images.opencollective.com/nx/0efbe42/logo.png" alt="Nx (by Nrwl)" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8: free icons, photos, illustrations, and music" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://transloadit.com/"><img src="https://avatars.githubusercontent.com/u/125754?v=4" alt="Transloadit" height="32"></a> <a href="https://www.ignitionapp.com"><img src="https://avatars.githubusercontent.com/u/5753491?v=4" alt="Ignition" height="32"></a> <a href="https://opensource.mercedes-benz.com/"><img src="https://avatars.githubusercontent.com/u/34240465?v=4" alt="Mercedes-Benz Group" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a> <a href="https://quickbookstoolhub.com"><img src="https://avatars.githubusercontent.com/u/95090305?u=e5bc398ef775c9ed19f955c675cdc1fb6abf01df&v=4" alt="QuickBooks Tool hub" height="32"></a></p>
<!--sponsorsend-->

## Technology Sponsors
7 changes: 6 additions & 1 deletion conf/globals.js
Original file line number Diff line number Diff line change
@@ -128,6 +128,10 @@ const es2023 = {
...es2022
};

const es2024 = {
...es2023
};


//-----------------------------------------------------------------------------
// Exports
@@ -145,5 +149,6 @@ module.exports = {
es2020,
es2021,
es2022,
es2023
es2023,
es2024
};
2 changes: 2 additions & 0 deletions docs/_examples/integration-tutorial-code/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.DS_Store
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* @fileoverview An example of how to integrate ESLint into your own tool
* @author Ben Perlmutter
*/

const { ESLint } = require("eslint");

// Create an instance of ESLint with the configuration passed to the function
function createESLintInstance(overrideConfig){
return new ESLint({ useEslintrc: false, overrideConfig: overrideConfig, fix: true });
}

// Lint the specified files and return the error results
async function lintAndFix(eslint, filePaths) {
const results = await eslint.lintFiles(filePaths);

// Apply automatic fixes and output fixed code
await ESLint.outputFixes(results);

return results;
}

// Log results to console if there are any problems
function outputLintingResults(results) {
// Identify the number of problems found
const problems = results.reduce((acc, result) => acc + result.errorCount + result.warningCount, 0);

if (problems > 0) {
console.log("Linting errors found!");
console.log(results);
} else {
console.log("No linting errors found.");
}
return results;
}

// Put previous functions all together
async function lintFiles(filePaths) {

// The ESLint configuration. Alternatively, you could load the configuration
// from a .eslintrc file or just use the default config.
const overrideConfig = {
env: {
es6: true,
node: true,
},
parserOptions: {
ecmaVersion: 2018,
},
rules: {
"no-console": "error",
"no-unused-vars": "warn",
},
};

const eslint = createESLintInstance(overrideConfig);
const results = await lintAndFix(eslint, filePaths);
return outputLintingResults(results);
}

// Export integration
module.exports = { lintFiles }
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* @fileoverview Test ESLint integration example code
* @author Ben Perlmutter
*/

const { lintFiles } = require("./example-eslint-integration");

async function testExampleEslintIntegration(){
const filePaths = ["sample-data/test-file.js"];
const lintResults = await lintFiles(filePaths);

// Test cases
if(lintResults[0].messages.length !== 6){
throw new Error("Expected 6 linting problems, got " + lintResults[0].messages.length);
}
const messageRuleIds = new Set()
lintResults[0].messages.forEach(msg => messageRuleIds.add(msg.ruleId));
if(messageRuleIds.size !== 2){
throw new Error("Expected 2 linting rule, got " + messageRuleIds.size);
}
if(!messageRuleIds.has("no-console")){
throw new Error("Expected linting rule 'no-console', got " + messageRuleIds);
}
console.log("All tests passed!");
}

testExampleEslintIntegration()
15 changes: 15 additions & 0 deletions docs/_examples/integration-tutorial-code/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "_integration-tutorial-code",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "node example-eslint-integration.test.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"eslint": "^8.39.0"
}
}
29 changes: 29 additions & 0 deletions docs/_examples/integration-tutorial-code/sample-data/test-file.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* @fileoverview Example data to lint using ESLint. This file contains a variety of errors.
* @author Ben Perlmutter
*/

// Unused variable 'y' (no-unused-vars from configured rules)
const y = 20;

function add(a, b) {
// Unexpected console statement (no-console from configured rules)
console.log('Adding two numbers');
return a + b;
}

// 'result' is assigned a value but never used (no-unused-vars from configured rules)
const result = add(x, 5);

if (x > 5) {
// Unexpected console statement (no-console from configured rules)
console.log('x is greater than 5');
} else {
// Unexpected console statement (no-console from configured rules)
console.log('x is not greater than 5');
}

// 'subtract' is defined but never used (no-unused-vars from configured rules)
function subtract(a, b) {
return a - b;
}
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "docs-eslint",
"private": true,
"version": "8.43.0",
"version": "8.44.0",
"description": "",
"main": "index.js",
"keywords": [],
2 changes: 1 addition & 1 deletion docs/src/contribute/index.md
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ title: Contribute to ESLint
eleventyNavigation:
key: contribute to eslint
title: Contribute to ESLint
order: 3
order: 4
---

One of the great things about open source projects is that anyone can contribute in any number of meaningful ways. ESLint couldn't exist without the help of the many contributors it's had since the project began, and we want you to feel like you can contribute and make a difference as well.
4 changes: 2 additions & 2 deletions docs/src/extend/custom-parsers.md
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ The `parse` method should simply return the [AST](#ast-specification) object.
The `parseForESLint` method should return an object that contains the required property `ast` and optional properties `services`, `scopeManager`, and `visitorKeys`.

* `ast` should contain the [AST](#ast-specification) object.
* `services` can contain any parser-dependent services (such as type checkers for nodes). The value of the `services` property is available to rules as `context.parserServices`. Default is an empty object.
* `services` can contain any parser-dependent services (such as type checkers for nodes). The value of the `services` property is available to rules as `context.sourceCode.parserServices`. Default is an empty object.
* `scopeManager` can be a [ScopeManager](./scope-manager-interface) object. Custom parsers can use customized scope analysis for experimental/enhancement syntaxes. The default is the `ScopeManager` object which is created by [eslint-scope](https://github.com/eslint/eslint-scope).
* Support for `scopeManager` was added in ESLint v4.14.0. ESLint versions that support `scopeManager` will provide an `eslintScopeManager: true` property in `parserOptions`, which can be used for feature detection.
* `visitorKeys` can be an object to customize AST traversal. The keys of the object are the type of AST nodes. Each value is an array of the property names which should be traversed. The default is [KEYS of `eslint-visitor-keys`](https://github.com/eslint/eslint-visitor-keys#evkkeys).
@@ -120,7 +120,7 @@ To learn more about using ESLint parsers in your project, refer to [Configure a

For a complex example of a custom parser, refer to the [`@typescript-eslint/parser`](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/parser) source code.

A simple custom parser that provides a `context.parserServices.foo()` method to rules.
A simple custom parser that provides a `context.sourceCode.parserServices.foo()` method to rules.

```javascript
// awesome-custom-parser.js
Loading