diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f649b4d304..e94db9e2a3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -328,6 +328,7 @@ importers: '@docusaurus/preset-classic': 2.0.0-beta.15 '@docusaurus/types': 2.0.0-beta.15 '@mdx-js/react': 1.6.22 + '@senecacdot/eslint-config-telescope': 1.0.0 clsx: 1.1.1 prism-react-renderer: 1.2.1 react: 17.0.1 @@ -343,6 +344,7 @@ importers: react-dom: 17.0.1_react@17.0.1 devDependencies: '@docusaurus/types': 2.0.0-beta.15 + '@senecacdot/eslint-config-telescope': link:../../tools/eslint src/web: specifiers: diff --git a/src/docs/.eslintrc.js b/src/docs/.eslintrc.js new file mode 100644 index 0000000000..d4f5956afe --- /dev/null +++ b/src/docs/.eslintrc.js @@ -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'], + }, + }, + }, + }, + ], +}; diff --git a/src/docs/package.json b/src/docs/package.json index 430a49d882..9b1c9ea6fd 100644 --- a/src/docs/package.json +++ b/src/docs/package.json @@ -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" }, @@ -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" } }