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

Add ESLint config for JavaScript Standard Style #2471

Merged
merged 5 commits into from Dec 5, 2022
Merged

Conversation

domoscargin
Copy link
Contributor

@domoscargin domoscargin commented Dec 2, 2022

Based on the work in alphagov/govuk-frontend#2849

This PR upgrades standard from 12.0.1 to 17.0.0 (as attempted in #2439)

In addition to allowing newer ES features without warnings and allowing IDEs to see issues visually whilst coding, this ignores the no-var, object-shorthand and quote-props warnings in the src folder.

We're also following the eslint-config-standard README.md and adding the following ESLint plugins:

"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-n": "^15.2.5",
"eslint-plugin-promise": "^6.0.1",

@domoscargin domoscargin added tooling dependencies Pull requests that update a dependency file javascript Pull requests that update Javascript code labels Dec 2, 2022
@domoscargin domoscargin added this to Needs review 🔍 in Design System Sprint Board via automation Dec 2, 2022
@netlify
Copy link

netlify bot commented Dec 2, 2022

You can preview this change here:

Name Link
🔨 Latest commit e7525d1
🔍 Latest deploy log https://app.netlify.com/sites/govuk-design-system-preview/deploys/638dad612643d600087caebd
😎 Deploy Preview https://deploy-preview-2471--govuk-design-system-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@domoscargin domoscargin requested a review from a team December 2, 2022 00:37
@domoscargin domoscargin force-pushed the bk-eslint branch 6 times, most recently from d95036a to 49368d7 Compare December 2, 2022 01:08
.eslintrc.js Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
lib/file-helper.js Outdated Show resolved Hide resolved
Copy link
Contributor

@colinrotherham colinrotherham left a comment

Choose a reason for hiding this comment

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

Brill, all approved

I'll leave you to rebase for the conflict 😭

Following the guidance in the `eslint-config-standard` README.md https://github.com/standard/eslint-config-standard#readme.
Adds a main `.eslintrc.js` config file which extends `standard`, ignores relevant folders, and sets the test environment to jest on relevant files.

Also adds an `.eslintrc.js` file in the `src` folder, to ignore `no-var`, `object-shorthand` and `quote-props` warnings.
This fix doesn't seem to break anything, though I'll admit it's straight off stackoverflow.
The `.eslintrc.js` was being copied to `public/deploy`.
@domoscargin domoscargin merged commit 8ecd932 into main Dec 5, 2022
Design System Sprint Board automation moved this from Needs review 🔍 to Done 🏁 Dec 5, 2022
@domoscargin domoscargin deleted the bk-eslint branch December 5, 2022 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file javascript Pull requests that update Javascript code tooling
Projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants