-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/lint #274
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
Closed
Closed
Feature/lint #274
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
425e733
husky pre-commit
interim17 1dc83f6
scripts, config, and library changes for linting and type checking
interim17 ded53aa
add github workflow for typechecking and linting
interim17 3bb8d5b
fix linting and typechecking errors throughout the repo
interim17 a14e276
use gatsby-plugin-react-helmet-async
interim17 42d32a7
streamline husky pre-commit
interim17 03363d9
install with yarn
interim17 e8512e3
use yarn in CI/CD script
interim17 2c9719d
add package resolutions and move things into dev dependencies
interim17 3473f2a
try different minimatch resolution
interim17 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| module.exports = { | ||
| root: true, | ||
| parser: "@typescript-eslint/parser", | ||
| parserOptions: { | ||
| project: "./tsconfig.json", | ||
| ecmaVersion: "latest", | ||
| sourceType: "module", | ||
| ecmaFeatures: { | ||
| jsx: true, | ||
| }, | ||
| }, | ||
| env: { | ||
| browser: true, | ||
| node: true, | ||
| es6: true, | ||
| }, | ||
| plugins: ["@typescript-eslint", "react", "react-hooks", "unused-imports"], | ||
| extends: [ | ||
| "eslint:recommended", | ||
| "plugin:@typescript-eslint/recommended", | ||
| "plugin:@typescript-eslint/recommended-requiring-type-checking", | ||
| "plugin:react/recommended", | ||
| "plugin:react-hooks/recommended", | ||
| "prettier", | ||
| ], | ||
| rules: { | ||
| "no-unused-vars": "off", | ||
| "@typescript-eslint/no-unused-vars": ["warn"], | ||
| "unused-imports/no-unused-imports": "error", | ||
| "@typescript-eslint/no-floating-promises": "warn", | ||
| "no-extra-boolean-cast": "warn", | ||
| "react/prop-types": "off", | ||
|
|
||
| // Currently this repo uses "any" and is generally loose | ||
| // on typing, so turning off some rules that might be | ||
| // best practice in the long run. | ||
| "@typescript-eslint/no-unsafe-assignment": "off", | ||
| "@typescript-eslint/no-unsafe-member-access": "off", | ||
| "@typescript-eslint/no-unsafe-argument": "off", | ||
| "@typescript-eslint/no-unsafe-return": "off", | ||
| "@typescript-eslint/explicit-module-boundary-types": "off", | ||
| "@typescript-eslint/no-explicit-any": "off", | ||
|
|
||
| // Added css module declartion if we want to move away | ||
| // from using require when importing css class names | ||
| // but turning this off for now | ||
| "@typescript-eslint/no-require-imports": "off", | ||
| }, | ||
| settings: { | ||
| react: { | ||
| version: "detect", | ||
| }, | ||
| }, | ||
| ignorePatterns: ["node_modules/", "public/", ".cache/"], | ||
| // TODO: opted to override linting for the preview templates | ||
| // as its too much to handle during the initial migration | ||
| // They are typed very generally and loosely | ||
| overrides: [ | ||
| { | ||
| files: ["src/cms/preview-templates/**/*.tsx"], | ||
| rules: { | ||
| "@typescript-eslint/no-unsafe-call": "off", | ||
| "@typescript-eslint/no-unsafe-member-access": "off", | ||
| "@typescript-eslint/no-unsafe-assignment": "off", | ||
| "@typescript-eslint/no-unsafe-return": "off", | ||
| "@typescript-eslint/no-explicit-any": "off", | ||
| }, | ||
| }, | ||
| ], | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| name: Lint and Typecheck | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, production] | ||
| pull_request: | ||
| branches: [main, production] | ||
|
|
||
| jobs: | ||
| lint-and-typecheck: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Use Node.js 18 | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: 18 | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Run ESLint | ||
| run: npm run lint | ||
|
|
||
| - name: Run TypeScript typecheck | ||
| run: npm run typecheck |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| npm run lint && npm run typecheck || exit 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It seems like for SSR the async version of react-helmet is preferred, and is also more maintained. I have yet to confirm what it does, and what this has changed. I just made the linter happy.
The Helmet is an example of something where I am unclear if we are intentionally implementing it or it is a legacy from the template used to start the repo.