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

Replace standard with standardx #79

Closed
wants to merge 5 commits into from

Conversation

StuAA78
Copy link
Contributor

@StuAA78 StuAA78 commented Jan 6, 2023

NOTE: We will not be implementing this change until either standardx is updated to support the latest version of standard, or standard is amended to allow setting of custom rules. See comment below for further details.

StandardJS covers 95% of our linting needs in one simple package. However there are some things it has no opinion on which we feel strongly about -- for example, ensuring parameters are always enclosed in brackets (even in cases where a single parameter's brackets are optional).

We'd like to be able to flag these things up during linting and standardx sems like the perfect package -- a drop-in replacement for standard which allows extra rules to be added. This means we can extend our linting without the pain of installing full-fat ESLint.

We did encounter a couple of problems after removing standard and installing standardx:

  • The first problem was an error Failed to load config "standard" to extend from. There was no consensus online how to fix this, some people suggested installing a bunch of ESLint modules, however we found that simply reinstalling standard did the trick.
  • The second problem was a Parsing error: Invalid ecmaVersion error for each file. This seems to be an incompatibility between standardx and eslint, where eslint defaults to ecmaVersion 13 but standardx isn't compatible with this. Enforcing ecmaVersion 12 in our package.json resolved this. Note that if standardx is updated then this may no longer be necessary.

StandardJS covers 95% of our linting needs in one simple package. However there are some things it has no opinion on which we feel strongly about -- for example, ensuring parameters are always enclosed in brackets (even in cases where a single parameter's brackets are optional).

We'd like to be able to flag these things up during linting and `standardx` sems like the perfect package -- a drop-in replacement for `standard` which allows extra rules to be added. This means we can extend our linting without the pain of installing full-fat ESLint.
@StuAA78 StuAA78 added the housekeeping Refactoring, tidying up or other work which supports the project label Jan 6, 2023
@StuAA78 StuAA78 self-assigned this Jan 6, 2023
Dropping in `standardx` in place of `standard` didn't immediately work!

The first problem was an error `Failed to load config "standard" to extend from`. There was no consensus online how to fix this, some people suggested installing a bunch of ESLint modules, however we found that simply reinstalling `standard` did the trick.

The second problem was numerous `Parsing error: Invalid ecmaVersion` errors. This seems to be an incompatibility between `standardx` and `eslint`, where `eslint` defaults to ecmaVersion 13 but `standardx` isn't compatible with this. Enforcing ecmaVersion 12 in our `package.json` resolved this.
@StuAA78 StuAA78 force-pushed the replace-standard-with-standardx branch from 6a5d093 to 1ffb35f Compare January 6, 2023 15:03
@StuAA78 StuAA78 added the do not merge Used for spikes and experiments label Aug 25, 2023
@StuAA78
Copy link
Contributor Author

StuAA78 commented Aug 25, 2023

At present we feel that standardx isn't currently suitable for us so we're going to put this on hold for the time being, but we'll keep an eye on standardx and see if things change:

  • It currently uses v16 of standard where the latest version is v17. This isn't really an issue as yet, as v17 hasn't introduced any new rules. However until it's fixed to use the latest version, there's always the possibility that when standard v18, v19 etc. comes in there will be additional rules that we won't be using. So we won't consider using it until that is resolved. A PR for this is currently awaiting approval.
  • As an alternative, an issue exists proposing that standard supports additional rules. It seems to have a bit of support behind it but as yet there doesn't seem to be any official yes or no.

So for now, we mark this as "do not merge" and will keep an eye on the state of standardx and standard.

@Cruikshanks
Copy link
Member

It is a shame. But the 2 PR's that suggest standards will get updated and support additional rules have not been updated since we created this PR. One of the folks has no gone to ESLint and after some consideration, I've come to the conclusion that is where we need to go.

We can produce all the coding conventions we like. The good folks read them but then forget quickly. The rest don't bother because they know they'll forget them.

It is not fair that new members of our team have to go through a period of having their PRs picked up on things that are buried in docs or that we simply haven't got around to writing up.

So, it is time to start managing the consistency of our project properly and just accept we need to switch to using ESLint.

We've started to have a play and they'll be more changes coming in the next weeks.

But they mean we can finally put this idea to rest.

@Cruikshanks Cruikshanks deleted the replace-standard-with-standardx branch May 2, 2024 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do not merge Used for spikes and experiments housekeeping Refactoring, tidying up or other work which supports the project
Projects
None yet
2 participants