Skip to content

Commit

Permalink
Update repo
Browse files Browse the repository at this point in the history
- Update to ESLint 8. (No need to test with ESLint 7 – we have never
  needed to test with multiple ESLint versions before, and ESLint 8
  changed nothing with the config system.)
- Update Prettier.
- Update all ESLint plugins. None of them had new conflicting rules.
- Update all other dependencies.
- Update Node.js versions to test with in CI: Drop Node.js 10 and 15
  since they are EOL. Add Node.js 16 and 17. Note:
  eslint-config-prettier still works with Node.js 10, and there’s no
  reason for that to change in the foreseeable future.
- Remove the table of contents in the readme. That’s a native GitHub
  feature these days.
- Update to npm lockfile version 2.
- Fix deprecation warning in build script.
- Fix lint errors from updated eslint-plugin-unicorn.

Supersedes and closes #201. (It was easier to do this myself than
reviewing that PR.)
  • Loading branch information
lydell committed Jan 14, 2022
1 parent 23c8169 commit ced358b
Show file tree
Hide file tree
Showing 10 changed files with 11,491 additions and 6,871 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ module.exports = {
"unicorn/filename-case": "off",
"unicorn/no-array-for-each": "off",
"unicorn/no-array-reduce": "off",
"unicorn/no-empty-file": "off",
"unicorn/no-nested-ternary": "off",
"unicorn/no-null": "off",
"unicorn/no-reduce": "off",
"unicorn/numeric-separators-style": "off",
"unicorn/prefer-flat-map": "off",
"unicorn/prefer-module": "off",
"unicorn/prefer-spread": "off",
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node-version: [15.x]
node-version: [16]

steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
node-version: [10.x, 12.x, 14.x, 15.x]
node-version: [12, 14, 16, 17]

steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

Expand Down
51 changes: 2 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,6 @@ This lets you use your favorite shareable config without letting its stylistic c

Note that this config _only_ turns rules _off,_ so it only makes sense using it together with some other config.

---

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [Installation](#installation)
- [Excluding deprecated rules](#excluding-deprecated-rules)
- [CLI helper tool](#cli-helper-tool)
- [Legacy](#legacy)
- [Special rules](#special-rules)
- [arrow-body-style and prefer-arrow-callback](#arrow-body-style-and-prefer-arrow-callback)
- [curly](#curly)
- [lines-around-comment](#lines-around-comment)
- [max-len](#max-len)
- [no-confusing-arrow](#no-confusing-arrow)
- [no-mixed-operators](#no-mixed-operators)
- [no-tabs](#no-tabs)
- [no-unexpected-multiline](#no-unexpected-multiline)
- [quotes](#quotes)
- [Enforce backticks](#enforce-backticks)
- [Forbid unnecessary backticks](#forbid-unnecessary-backticks)
- [Example double quote configuration](#example-double-quote-configuration)
- [Example single quote configuration](#example-single-quote-configuration)
- [vue/html-self-closing](#vuehtml-self-closing)
- [Other rules worth mentioning](#other-rules-worth-mentioning)
- [no-sequences](#no-sequences)
- [Contributing](#contributing)
- [License](#license)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Installation

Install eslint-config-prettier:
Expand Down Expand Up @@ -666,24 +635,7 @@ You can also supply a custom message if you want:

## Contributing

eslint-config-prettier has been tested with:

- ESLint 7.25.0
- eslint-config-prettier 7.0.0 requires ESLint 7.0.0 or newer, while eslint-config-prettier 6.15.0 and older should also work with ESLint versions down to 3.x.
- eslint-config-prettier 6.11.0 and older were tested with ESLint 6.x
- eslint-config-prettier 5.1.0 and older were tested with ESLint 5.x
- eslint-config-prettier 2.10.0 and older were tested with ESLint 4.x
- eslint-config-prettier 2.1.1 and older were tested with ESLint 3.x
- prettier 2.2.1
- @babel/eslint-plugin 7.13.16
- @typescript-eslint/eslint-plugin 4.22.0
- eslint-plugin-babel 5.3.1
- eslint-plugin-flowtype 5.7.2
- eslint-plugin-prettier 3.4.0
- eslint-plugin-react 7.23.2
- eslint-plugin-standard 4.0.2
- eslint-plugin-unicorn 31.0.0
- eslint-plugin-vue 7.9.0
See [package.json] for the exact versions of ESLint, Prettier and ESLint plugins that eslint-config-prettier has been tested with.

Have new rules been added since those versions? Have we missed any rules? Is there a plugin you would like to see exclusions for? Open an issue or a pull request!

Expand Down Expand Up @@ -757,6 +709,7 @@ When you’re done, run `npm test` to verify that you got it all right. It runs
[no-tabs]: https://eslint.org/docs/rules/no-tabs
[no-unexpected-multiline]: https://eslint.org/docs/rules/no-unexpected-multiline
[overrides]: https://eslint.org/docs/user-guide/configuring#configuration-based-on-glob-patterns
[package.json]: https://github.com/prettier/eslint-config-prettier/blob/main/package.json
[prefer-arrow-callback]: https://eslint.org/docs/rules/prefer-arrow-callback
[prettier]: https://github.com/prettier/prettier
[quotes]: https://eslint.org/docs/rules/quotes
Expand Down
17 changes: 7 additions & 10 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ if (module === require.main) {

Promise.all(args.map((file) => eslint.calculateConfigForFile(file)))
.then((configs) => {
const rules = [].concat(
...configs.map(({ rules }, index) =>
Object.entries(rules).map((entry) => [...entry, args[index]])
)
const rules = configs.flatMap(({ rules }, index) =>
Object.entries(rules).map((entry) => [...entry, args[index]])
);
const result = processRules(rules);
if (result.stderr) {
Expand Down Expand Up @@ -183,12 +181,11 @@ function processRules(configRules) {
}

function filterRules(rules, fn) {
return Object.entries(rules)
.filter(([ruleName, value]) => fn(ruleName, value))
.reduce((obj, [ruleName]) => {
obj[ruleName] = true;
return obj;
}, Object.create(null));
return Object.fromEntries(
Object.entries(rules)
.filter(([ruleName, value]) => fn(ruleName, value))
.map(([ruleName]) => [ruleName, true])
);
}

function filterRuleNames(rules, fn) {
Expand Down
Loading

0 comments on commit ced358b

Please sign in to comment.