Skip to content

Commit

Permalink
add eslint to Docusaurus and play together with turborepo's linting
Browse files Browse the repository at this point in the history
  • Loading branch information
cindyorangis committed Feb 19, 2022
1 parent 9960284 commit fd52e15
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
2 changes: 2 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: '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: {
// 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', '.ts', 'tsx'],
},
},
},
},
],
};
4 changes: 3 additions & 1 deletion src/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

0 comments on commit fd52e15

Please sign in to comment.