From ea2f6debda5fc85379c533a6521293a0e4ceea14 Mon Sep 17 00:00:00 2001 From: Mark Banner Date: Mon, 22 Apr 2024 10:41:30 +0100 Subject: [PATCH] Switch to prettier for formatting; drop obsolete ESLint formatting rules. (#238) --- .babelrc | 8 +- .eslintrc.json | 79 +- .github/workflows/ci.yml | 50 +- CODE_OF_CONDUCT.md | 5 +- README.md | 16 +- SECURITY.md | 12 +- docs/rules/customization.md | 26 +- docs/rules/fixing-violations.md | 21 +- docs/rules/method.md | 11 +- docs/rules/property.md | 13 +- index.js | 40 +- lib/ruleHelper.js | 300 +- lib/rules/method.js | 174 +- lib/rules/property.js | 42 +- package-lock.json | 6503 ----------------------------- package.json | 4 +- prettier.config.mjs | 4 + tests/parsers/fantasy-callee.js | 74 +- tests/parsers/fantasy-operator.js | 201 +- tests/rules/method.js | 661 +-- tests/rules/property.js | 344 +- yarn.lock | 1588 ++++--- 22 files changed, 1880 insertions(+), 8296 deletions(-) delete mode 100644 package-lock.json create mode 100644 prettier.config.mjs diff --git a/.babelrc b/.babelrc index 8bf5832..d51d656 100644 --- a/.babelrc +++ b/.babelrc @@ -1,6 +1,6 @@ { - // @babel/eslint-parser, which is used in the test suite, requires a config - // file by default, which is why this file exists. Instead of adding - // configuration here, we should pass configuration to the parser using - // `parserOptions` for each test instead. + // @babel/eslint-parser, which is used in the test suite, requires a config + // file by default, which is why this file exists. Instead of adding + // configuration here, we should pass configuration to the parser using + // `parserOptions` for each test instead. } diff --git a/.eslintrc.json b/.eslintrc.json index 50cbd58..7bdf7fa 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,57 +1,26 @@ { - "rules": { - "lines-around-comment": [ - 2, - { - "allowArrayStart": true, - "allowBlockStart": true, - "beforeBlockComment": false, - "beforeLineComment": true - } - ], - "prefer-template": [ - 2 - ], - "object-shorthand": [ - 2 - ], - "prefer-const": [ - 2 - ], - "no-var": [ - 2 - ], - "indent": [ - 2, - 4 - ], - "quotes": [ - 2, - "double" - ], - "linebreak-style": [ - 2, - "unix" - ], - "semi": [ - 2, - "always" - ], - "space-in-parens": [ - 2, - "never" - ], - "valid-jsdoc": [ - 2 - ], - "require-jsdoc": [ - 2 - ] - }, - "env": { - "es6": true, - "browser": true, - "node": true - }, - "extends": "eslint:recommended" + "rules": { + "lines-around-comment": [ + 2, + { + "allowArrayStart": true, + "allowBlockStart": true, + "allowObjectStart": true, + "beforeBlockComment": false, + "beforeLineComment": true + } + ], + "prefer-template": [2], + "object-shorthand": [2], + "prefer-const": [2], + "no-var": [2], + "valid-jsdoc": [2], + "require-jsdoc": [2] + }, + "env": { + "es6": true, + "browser": true, + "node": true + }, + "extends": ["eslint:recommended", "prettier"] } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e3c1223..a176950 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,35 +1,35 @@ name: CI on: - push: - branches: [main] - pull_request: - branches: [main] + push: + branches: [main] + pull_request: + branches: [main] jobs: - ci: - name: 'Test: Node ${{ matrix.node-version }} - ESLint ${{ matrix.eslint-version }}' - runs-on: ubuntu-latest - strategy: - matrix: - eslint-version: [8.x, 7.x, 6.x] - node-version: [16.x, 14.x] - steps: - - uses: actions/checkout@v2 + ci: + name: "Test: Node ${{ matrix.node-version }} - ESLint ${{ matrix.eslint-version }}" + runs-on: ubuntu-latest + strategy: + matrix: + eslint-version: [8.x, 7.x, 6.x] + node-version: [16.x, 14.x] + steps: + - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} - - name: Use ESLint ${{ matrix.eslint-version }} - run: yarn upgrade eslint@${{ matrix.eslint-version }} + - name: Use ESLint ${{ matrix.eslint-version }} + run: yarn upgrade eslint@${{ matrix.eslint-version }} - - name: Install - run: yarn install + - name: Install + run: yarn install - - name: Lint - run: yarn run lint + - name: Lint + run: yarn run lint - - name: Test - run: yarn run test + - name: Test + run: yarn run test diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 498baa3..0d424fd 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,10 +1,11 @@ # Community Participation Guidelines -This repository is governed by Mozilla's code of conduct and etiquette guidelines. +This repository is governed by Mozilla's code of conduct and etiquette guidelines. For more details, please read the -[Mozilla Community Participation Guidelines](https://www.mozilla.org/about/governance/policies/participation/). +[Mozilla Community Participation Guidelines](https://www.mozilla.org/about/governance/policies/participation/). ## How to Report + For more information on how to report violations of the Community Participation Guidelines, please read our '[How to Report](https://www.mozilla.org/about/governance/policies/participation/reporting/)' page.