Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enables eslint on the full repo and adds a rule for no only() tests #3659

Merged
merged 12 commits into from
Jun 22, 2022

Conversation

tony-sull
Copy link
Contributor

@tony-sull tony-sull commented Jun 21, 2022

Changes

  • Enables eslint on all packages except webapi (requires too many linter fixes for now)
  • Adds a lint rule to error on only() tests
  • Fixes all linter errors in the repo (mostly no-console and no-shadow errors)

Example CI failure when a pull request had a .only() test 🎉

Testing

N/A

Docs

N/A

@changeset-bot
Copy link

changeset-bot bot commented Jun 21, 2022

⚠️ No Changeset found

Latest commit: edf4e94

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions bot added pkg: astro Related to the core `astro` package (scope) pkg: create-astro Related to the `create-astro` package (scope) pkg: integration Related to any renderer integration (scope) feat: markdown Related to Markdown (scope) 🚨 action Modifies GitHub Actions labels Jun 21, 2022
@github-actions github-actions bot removed the 🚨 action Modifies GitHub Actions label Jun 21, 2022
@github-actions github-actions bot added the 🚨 action Modifies GitHub Actions label Jun 21, 2022
!packages/astro/**/*.js
!packages/astro/**/*.ts
packages/astro/test/**/*.js
**/*.d.ts
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allow all .js and .ts files, ignore .d.ts

packages/astro/test/**/*.js
**/*.d.ts
packages/**/dist/**/*
packages/**/fixtures/**/*
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enable all packages, but skip dist and test fixtures

**/*.d.ts
packages/**/dist/**/*
packages/**/fixtures/**/*
packages/webapi/**/*
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

webapi would need a much larger change to fix ~40 linter errors

@@ -54,9 +54,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
eslint: true
eslint_args: --ignore-pattern test --ignore-pattern vendor
Copy link
Contributor Author

@tony-sull tony-sull Jun 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allowing eslint in CI to use the same .eslintignore and .eslintrc.cjs config files

const bundledCSSHREF = $('link[rel=stylesheet][href^=/assets/]').attr('href');
const bundledCSS = await fixture.readFile(bundledCSSHREF.replace(/^\/?/, '/'));
expect(bundledCSS, 'includes used component classes').to.match(/\.bg-purple-600{/);
const $md = cheerio.load(html);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was shadowing the $ variable shared by all other tests that were loading /index.html

@@ -1,4 +1,4 @@
import { resolve } from 'path';
import path from 'path';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolve was being shadowed in promiseWithoutTimeout calls

@tony-sull tony-sull marked this pull request as ready for review June 21, 2022 15:53
@matthewp
Copy link
Contributor

lgtm

Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only() PR I've ever wanted! Approved.

My apologies to @bholmesdev

@tony-sull tony-sull merged commit b8c6dab into main Jun 22, 2022
@tony-sull tony-sull deleted the chore/eslint-no-only-tests branch June 22, 2022 15:59
SiriousHunter pushed a commit to SiriousHunter/astro that referenced this pull request Feb 3, 2023
…withastro#3659)

* enabling eslint on the all packages and tests

* enabling for all packages

* TEMP: adding an only() test to verify it fails CI

* using our eslint config and ignore in CI

* removing the temporary .only() test

* update lock file

* lint: fixing new test with a no-shadow warning

* chore: update lock file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 action Modifies GitHub Actions feat: markdown Related to Markdown (scope) pkg: astro Related to the core `astro` package (scope) pkg: create-astro Related to the `create-astro` package (scope) pkg: integration Related to any renderer integration (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants