-
Notifications
You must be signed in to change notification settings - Fork 41
Decouple linting, formatting, and pre-commit from external dotfiles #7447
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
base: main
Are you sure you want to change the base?
Conversation
Previously the code removed prettier-plugin-tailwindcss from base, however, now that all settings are defined directly, can just remove the plugin from the list.
This can be kept because it is like any other dependency in the pre-commit config, however, it should have a description since the title of the repository is ambiguous.
With gitlab, the user has to login to gitlab in order to use the hook. Since development of specify occurs on github, it makes sense to use the github version to prevent developers from having to setup another account.
markdownlint relies on a ruby gem, which requires a version of ruby that macOS machines don't ship with by default. Since ruby isn't a language that is in the specify codebase, it would be better to use a markdown linter that uses node.
Copies the rules previously in the import. There is no need for stylelint-config-prettier after stylelint version 15, see https://www.npmjs.com/package/stylelint-config-prettier
No longer necessary since these configuration variables are now directly in the file
Some debugging remains for how testFiles and abbreviationsConfig are handled
Tested and eslint now runs fine without errors
These are no longer necessary as dev dependencies
These were requirements in max's dotfiles, and so are now required by specify
Changes look good, single quote is respected, which is the biggest difference between specify's settings and the default. Ran over the entirety of js_src and no changes to 99% of files.
The ci pipeline requires the lockfile and package.json to be in sync, this should resolve that error.
Triggered by 28d7155 on branch refs/heads/issue-7402
|
04cc77c installs the latest versions of prettier and the plugins, don't see a reason not to use the latest version, as these are just formatters. |
eslint-plugin-markdown is depracated, npm suggests eslint/markdown as a replacement
Triggered by c030cba on branch refs/heads/issue-7402
Since eslint is largely ignored in the current ci pipeline, starting from the defaults and building up may make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for doing this! @CarolineDenis, we should discuss what changes need to be made to address
Note that running the existing pre-commit configuration over the entire codebase will result in a lot of changes, it appears like many directories have never been touched by pre-commit (perhaps because they haven't seen changes in a while, or pre-commit is not consistently used).
|
This pull request isn't ready to merge just yet, mostly because I'm trying to work out a proposal for what to do with eslint. The current config is using a version of eslint (version 8) that is depracated. However, just switching back to the recommended configuration1 will litter the codebase with comment strings that say to ignore a previous rule. In a perfect world I could get all the plugins and rules to line up. As far as I can tell, the following are done at each stage of the pipeline:
Currently, the only thing that eslint will do is autofix what it can (which isn't supported for all rules, just some). Errors are ignored for both prettier and eslint in the pipeline, presumably because they were too restrictive at some time. Warnings are... well just warnings. Example: https://github.com/specify/specify7/actions/runs/18353184533/job/52278324256 I don't think stylelint is used anywhere, but there is a config for it, I guess if an individual developer wanted to set it up in their IDE they could use it. Footnotes
|

Fixes #7402
This PR removes the link between Max Platiiuk's dotfiles and the Specify repository for formatting, linting and the pre-commit config. I have tried to stay as close to a copy and paste operation as possible, however the following two changes were made:
Eslint is definitely where things get the most complicated, particularly because I don't think eslint has been a part of the ci pipeline for a while due to the high number of errors it produces?
specify7/.github/workflows/test.yml
Lines 270 to 274 in cbff898
I think it may be prudent to think about where in the pipeline each type of error is expected to be caught, and which tools are mandatory to setup. For example, if a developer has pre-commit setup, are they good to go? Or should they also run
npm run teston their machine? Which jobs are handled by the ci runners, compared to local testing? A good candidate for developer documentation.Note
Gitguardian has a pre-commit config that can catch secrets before they are commited as a pre-commit check (or pushed as a pre-push check), whereas I believe the PR integration will only catch the secret after it has been committed (it can be then rotated/revoked, but that's a pain). An example of a case where it matters where a check is run.
Dependency changes
The following dependencies were added to the Specify frontend. These were always dependencies for the project, they were just further upstream because they were dependencies for the dotfiles.
Checklist
self-explanatory (or properly documented)
Testing instructions