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

Fixes #2970 add eslint configurations to Docusaurus and play together with turborepo's linting #2971

Merged
merged 3 commits into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
30 changes: 30 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions src/docs/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
module.exports = {
extends: '@senecacdot/eslint-config-telescope',
overrides: [
{
files: ['./**/*.js'],
extends: [
'plugin:import/typescript',
'plugin:node/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
],
plugins: ['react', 'react-hooks'],
rules: {
'@typescript-eslint/no-shadow': 'off',
// https://github.com/facebook/docusaurus/blob/main/.eslintrc.js#L122
// Ignore certain webpack aliases because they can't be resolved
'import/no-unresolved': [
'off',
{
ignore: ['^@theme', '^@docusaurus', '^@generated', '^@site'],
},
],
'global-require': 'off',
'no-use-before-define': 'off',
'node/no-missing-import': 'off',
'node/no-unsupported-features/es-syntax': 'off',
'react/jsx-filename-extension': ['error', { extensions: ['.js', '.jsx'] }],
// https://github.com/facebook/docusaurus/blob/main/.eslintrc.js#L154
// We build a static site, and nearly all components don't change.
'react/no-array-index-key': 'off',
'react/prop-types': 'off',
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx'],
},
},
},
},
],
};
6 changes: 4 additions & 2 deletions src/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "telescope-docs",
"name": "@senecacdot/telescope-docs",
"version": "0.0.1",
"private": true,
"scripts": {
Expand All @@ -10,6 +10,7 @@
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve --port 4631 --host 0.0.0.0",
"lint": "pnpm eslint",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids"
},
Expand Down Expand Up @@ -39,6 +40,7 @@
"node": ">=14"
},
"devDependencies": {
"@docusaurus/types": "2.0.0-beta.15"
"@docusaurus/types": "2.0.0-beta.15",
"@senecacdot/eslint-config-telescope": "1.0.0"
}
}
1 change: 1 addition & 0 deletions tools/eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"eslint-plugin-jest": "25.3.4",
"eslint-plugin-jest-playwright": "0.2.1",
"eslint-plugin-jsx-a11y": "6.5.1",
"eslint-plugin-node": "11.1.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Where do we use this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In PR #2853, we added a number of eslint overrides, and they addressed all the eslint errors we were getting for the Docusaurus app. Hence, the overrides in this PR are identical to what we had previously (just located in src/docs as opposed to /).

For some reason, I am no longer getting any eslint errors for the Docusaurus app on master right now. I don't know if this PR is even needed...

Copy link
Contributor

Choose a reason for hiding this comment

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

What if you introduce an eslint error, does it catch that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@menghif we use eslint-plugin-node here

'node/no-missing-import': 'off',
'node/no-unsupported-features/es-syntax': 'off',

or else we get errors like these
2022-02-22 13_24_38-Window

"eslint-plugin-prettier": "3.4.1",
"eslint-plugin-promise": "5.2.0",
"eslint-plugin-react": "7.28.0",
Expand Down