Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

EVG-20048: Introduce check-file plugin #2109

Merged
merged 33 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b1ba409
Introduce check-file plugin
SupaJoon Oct 18, 2023
a3e406c
verify tsx and use errorIfStrict
SupaJoon Oct 20, 2023
9889520
prodserver -> prod-server
SupaJoon Oct 30, 2023
647483b
cypress files
SupaJoon Oct 30, 2023
d54ce57
eventLogDiffs
SupaJoon Oct 30, 2023
87b0510
inactive style
SupaJoon Oct 30, 2023
f43cd07
more file name updates
SupaJoon Oct 30, 2023
4976741
toast test
SupaJoon Oct 30, 2023
bd90447
update naming conventions
SupaJoon Oct 30, 2023
f8ea637
404 -> NotFound
SupaJoon Oct 30, 2023
aa95bc4
remove tsx file (replaced by ts file)
SupaJoon Oct 30, 2023
0848548
event copy component
SupaJoon Oct 30, 2023
bc5a909
tsx -> ts
SupaJoon Oct 30, 2023
90c44fe
HostEventString comp
SupaJoon Oct 30, 2023
802787e
utils.tsx -> Utils.tsx
SupaJoon Oct 30, 2023
1f66210
ts -> tsx
SupaJoon Oct 30, 2023
c1a86a6
tsx -> ts
SupaJoon Oct 30, 2023
c8d17f9
update check-file edge cases
SupaJoon Oct 30, 2023
ad6d4c0
Merge branch 'main' of github.com:evergreen-ci/spruce into EVG-20048
SupaJoon Oct 30, 2023
59e8c90
Merge branch 'main' of github.com:evergreen-ci/spruce into EVG-20048
SupaJoon Nov 1, 2023
9034003
comments
SupaJoon Nov 1, 2023
de7196a
create useSubscriptionData hook file
SupaJoon Nov 1, 2023
827ea8e
merge main
SupaJoon Nov 15, 2023
750a352
update buildbaron file name
SupaJoon Nov 15, 2023
161996b
Divider.tsx -> divider.ts
SupaJoon Nov 15, 2023
916dcad
simplify rules
SupaJoon Nov 15, 2023
998cf28
try and fix error
SupaJoon Nov 15, 2023
1013516
merge main
SupaJoon Nov 27, 2023
8fc1528
Merge branch 'main' of github.com:evergreen-ci/spruce into EVG-20048
SupaJoon Nov 27, 2023
bbece55
change dir casing
SupaJoon Nov 27, 2023
33f1d7b
Revert "change dir casing"
SupaJoon Nov 27, 2023
45a7c6e
fix casing
SupaJoon Nov 27, 2023
5defa1c
eslint:fix
SupaJoon Nov 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = {
"plugin:jsdoc/recommended-typescript-error",
"plugin:prettier/recommended", // Note: prettier must ALWAYS be the last extension.
],
plugins: ["@typescript-eslint", "sort-destructure-keys"],
plugins: ["@typescript-eslint", "sort-destructure-keys", "check-file"],
settings: {
react: {
version: "detect",
Expand Down Expand Up @@ -96,6 +96,18 @@ module.exports = {
// Rules for prettier.
"prettier/prettier": errorIfStrict, // Makes Prettier issues warnings rather than errors.
"sort-destructure-keys/sort-destructure-keys": errorIfStrict,
"check-file/filename-naming-convention": [
"warn",
Copy link
Contributor

Choose a reason for hiding this comment

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

Use our constant.

Suggested change
"warn",
WARN,

Copy link
Contributor

Choose a reason for hiding this comment

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

or alternatively errorIfStrict is there any reason we wouldn't want to enforce files are consistently named?

Copy link
Contributor Author

@SupaJoon SupaJoon Oct 20, 2023

Choose a reason for hiding this comment

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

What do you think about using the WARN flag until all of the problems are resolved and then apply errorIfStrict? Alternatively we can do them at once but there will be over 42 renamed files and imports.

{
"**/*.graphql": "KEBAB_CASE",
"cypress/integration/**/*.ts": "SNAKE_CASE",
"scripts/**/*.{js,ts}": "KEBAB_CASE",
"src/**/*.{js,ts}": "CAMEL_CASE",
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use !(something) syntax to not match on values that can be hooks.

e.g.
src/**/!(use)*.ts Will match all ts files that do not have the use keyword aka are not hooks.

Checkout for an easy way to test out glob match rules.
https://www.digitalocean.com/community/tools/glob?comments=true&glob=src/**/!(use)*.tsx&matches=false&tests=src/hooks/useTestFile.ts&tests=src/components/SomeRandomComponent.tsx

},
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we further trim these down? So we don't have 4 different conventions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the smallest set that makes sense to me. Let me know what you want to trim and why.

{
ignoreMiddleExtensions: true,
},
],
},
overrides: [
// For React Typescript files in src.
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
"eslint": "8.19.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-prettier": "8.8.0",
"eslint-plugin-check-file": "2.6.2",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-jest": "27.2.1",
Expand Down
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8976,6 +8976,14 @@ eslint-module-utils@^2.7.3:
dependencies:
debug "^3.2.7"

[email protected]:
version "2.6.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-check-file/-/eslint-plugin-check-file-2.6.2.tgz#2e60d567ce7d087727d19c7e7b5b9def1e5b693e"
integrity sha512-z3Rur4JjOdNH0fia1IH7JQseo9NLuFVtw9j8P6z2c5XmXWemH7/qGpmMB8XbOt9bJBNpmPlNAGJty9b3EervPw==
dependencies:
is-glob "^4.0.3"
micromatch "^4.0.5"

eslint-plugin-cypress@^2.12.1:
version "2.14.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-cypress/-/eslint-plugin-cypress-2.14.0.tgz#c65e1f592680dd25bbd00c86194ee85fecf59bd7"
Expand Down