Skip to content

Commit

Permalink
feat: support eslint@8
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
 - node 12 is no longer supported, support for node 18 was added.
 - eslint8 will not support the prettier/prettier rule.
    reading the config from prettier/prettier is not
    supported by eslint.
    It's possible it could maybe be added later through
    hacks (currently in place) / private api usage,
    but eslint8 does not give access to the config for a file.
  • Loading branch information
NullVoxPopuli committed Jul 15, 2022
1 parent 3c2a364 commit 4193fac
Show file tree
Hide file tree
Showing 30 changed files with 5,863 additions and 8,756 deletions.
44 changes: 11 additions & 33 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@

module.exports = {
root: true,
parser: '@babel/eslint-parser',
parserOptions: {
ecmaVersion: 2021,
ecmaVersion: 2022,
sourceType: 'script',
ecmaFeatures: {
legacyDecorators: true,
},
babelOptions: {
configFile: './babel.config.cjs',
},
},
plugins: ['eslint-plugin', 'filenames', 'import', 'jest', 'node', 'prettier'],
plugins: ['eslint-plugin', 'filenames', 'import', 'node', 'prettier'],
extends: [
'eslint:recommended',
'plugin:eslint-comments/recommended',
'plugin:eslint-plugin/all',
'plugin:jest/recommended',
'plugin:jest/style',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:node/recommended',
Expand All @@ -21,7 +26,6 @@ module.exports = {
env: {
es6: true,
node: true,
jest: true,
},
rules: {
// Optional eslint rules:
Expand Down Expand Up @@ -103,24 +107,6 @@ module.exports = {
// Filenames:
'filenames/match-regex': ['error', '^.?[a-z0-9-]+$'], // Kebab-case.

// Optional jest rules:
'jest/consistent-test-it': 'error',
'jest/prefer-lowercase-title': 'error',
'jest/no-duplicate-hooks': 'error',
'jest/prefer-expect-resolves': 'error',
'jest/no-hooks': 'error',
'jest/no-if': 'error',
'jest/no-large-snapshots': 'error',
'jest/no-test-return-statement': 'error',
'jest/prefer-called-with': 'error',
'jest/prefer-hooks-on-top': 'error',
'jest/prefer-spy-on': 'error',
'jest/prefer-strict-equal': 'error',
'jest/prefer-todo': 'error',
'jest/require-top-level-describe': 'error',
'jest/require-to-throw-message': 'error',
'jest/valid-title': 'error',

// Optional import rules:
'import/extensions': 'error',
'import/first': 'error',
Expand All @@ -139,11 +125,6 @@ module.exports = {
'import/unambiguous': 'error',
},
overrides: [
{
// Test files:
files: ['tests/**/*.js'],
env: { jest: true },
},
{
// Config files:
files: ['commitlint.config.js'],
Expand All @@ -153,9 +134,9 @@ module.exports = {
},
{
// Markdown code samples in documentation:
files: ['**/*.md'],
files: ['**/*.md----TEMP-DISABLED'],
plugins: ['markdown'],
parser: 'markdown-eslint-parser',
parser: 'markdown-eslint-eslint',
parserOptions: {
sourceType: 'module',
ecmaFeatures: { legacyDecorators: true },
Expand All @@ -165,9 +146,6 @@ module.exports = {
'filenames/match-regex': 'off',
'import/no-unresolved': 'off',
'import/unambiguous': 'off',
'jest/expect-expect': 'off',
'jest/no-test-callback': 'off',
'jest/require-top-level-describe': 'off',
'no-console': 'off',
'no-undef': 'off',
'no-unused-expressions': 'off',
Expand Down
19 changes: 19 additions & 0 deletions .github/actions/pnpm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Setup pnpm
description: Setup pnpm with cache
runs:
using: "composite"
steps:
- name: Cache pnpm modules
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- uses: pnpm/[email protected]
with:
version: 7.1.2
- name: Install Dependencies
run: pnpm install
shell: bash
163 changes: 121 additions & 42 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,72 +13,151 @@ env:
CI: true

jobs:
install_dependencies:
name: Install Dependencies
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: volta-cli/action@v1
- uses: ./.github/actions/pnpm

#############################################################

lint:
name: Lint JS
runs-on: ubuntu-latest
needs: ['install_dependencies']
steps:
- uses: actions/checkout@v3
- uses: volta-cli/action@v1
- uses: ./.github/actions/pnpm
- run: pnpm lint:js

lint_tooling:
name: Lint Tooling
runs-on: ubuntu-latest
needs: ['install_dependencies']
steps:
- uses: actions/checkout@v3
- uses: volta-cli/action@v1
- uses: ./.github/actions/pnpm

- name: Semantic Release
run: pnpm semantic-release --dry-run
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

lint_docs:
name: Lint Docs
runs-on: ubuntu-latest
needs: ['install_dependencies']
steps:
- uses: actions/checkout@v3
- uses: volta-cli/action@v1
- uses: ./.github/actions/pnpm
- run: pnpm lint:docs

lint_commits:
name: Lint Commit Messages
runs-on: ubuntu-latest
needs: ['install_dependencies']
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: volta-cli/action@v1
- uses: wagoid/[email protected]

lint_readme:
name: README up to date
runs-on: ubuntu-latest
needs: ['install_dependencies']
steps:
- uses: actions/checkout@v3
- uses: volta-cli/action@v1
- uses: ./.github/actions/pnpm
- run: pnpm update && git diff --exit-code README.md docs/

#############################################################

tests:
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
name: Test
runs-on: ubuntu-latest
needs: ['install_dependencies']
strategy:
fail-fast: false
matrix:
node:
- "14"
- "16"
- "18"
eslint:
- "eslint@8"
- "eslint@7"
- "eslint@6"
steps:
- uses: actions/checkout@v2
- uses: volta-cli/action@v1
- uses: actions/checkout@v3
- uses: volta-cli/action@v1
with:
node-version: ${{ matrix.node }}
- run: |
yarn install
yarn remove eslint
yarn add ${{ matrix.eslint }}
- uses: ./.github/actions/pnpm
- name: "Use ${{ matrix.eslint }}"
run: |
pnpm remove eslint
pnpm add ${{ matrix.eslint }}
- name: Test with ${{ matrix.node }}
run: |
echo "Matrix Info"
echo "Intended: ${{ matrix.node }}, ${{ matrix.eslint }}"
echo "node: $(node -v)"
echo "yarn why eslint"
yarn why eslint
yarn test:coverage --runInBand
yarn update && git diff --exit-code README.md docs/
echo "pnpm why eslint"
pnpm why eslint
pnpm test
smoke-tests:
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
name: Smoke Tests
name: ${{ matrix.script }}
runs-on: ubuntu-latest
needs: ['install_dependencies']
strategy:
fail-fast: false
matrix:
# tese are all relative to the smoke-tests directory
script:
- integration/position-default
- integration/position-prettier
- integration/external-config-prettier
- examples/ember
- examples/typescript
- issue-reproductions/147
- issue-reproductions/195
- issue-reproductions/196
- issue-reproductions/289
- issue-reproductions/313


steps:
- uses: actions/checkout@v3
- uses: volta-cli/action@v1
- uses: ./.github/actions/pnpm
- run: ./scripts/smoke-test.sh smoke-tests/${{ matrix.script }}

publish:
name: Release
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs: [tests]

steps:
- uses: actions/checkout@v2
- uses: volta-cli/action@v1
- uses: actions/checkout@v3
- uses: volta-cli/action@v1
- uses: ./.github/actions/pnpm

# One line per configuration
- run: ./scripts/smoke-test.sh smoke-tests/integration/position-default
- run: ./scripts/smoke-test.sh smoke-tests/integration/position-prettier
- run: ./scripts/smoke-test.sh smoke-tests/integration/external-config-prettier
- run: ./scripts/smoke-test.sh smoke-tests/examples/ember
- run: ./scripts/smoke-test.sh smoke-tests/examples/typescript
- run: ./scripts/smoke-test.sh smoke-tests/issue-reproductions/147
- run: ./scripts/smoke-test.sh smoke-tests/issue-reproductions/195
- run: ./scripts/smoke-test.sh smoke-tests/issue-reproductions/196
- run: ./scripts/smoke-test.sh smoke-tests/issue-reproductions/289
- run: ./scripts/smoke-test.sh smoke-tests/issue-reproductions/313

# publish:
# name: Release
# runs-on: ubuntu-latest
# if: github.ref == 'refs/heads/master'
# needs: [tests]

# steps:
# - uses: actions/checkout@v2
# - uses: volta-cli/action@v1
# - run: yarn install

# - name: Release
# env:
# GITHUB_TOKEN: ${{ secrets.GH_PAT }}
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# run: yarn semantic-release
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: pnpm semantic-release
65 changes: 0 additions & 65 deletions .github/workflows/lint.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ logs
# Dependencies
node_modules
smoke-tests/**/yarn.lock
smoke-tests/**/pnpm-lock.yaml
smoke-tests/**/node_modules
yarn.lock

# Misc
.eslintcache
Expand Down
Loading

0 comments on commit 4193fac

Please sign in to comment.