From f26676b5efd2e43f19cbf7b087a45110794a9633 Mon Sep 17 00:00:00 2001 From: Cindy Le Date: Thu, 17 Feb 2022 16:26:06 -0500 Subject: [PATCH 1/3] add eslint to Docusaurus and play together with turborepo's linting --- pnpm-lock.yaml | 2 ++ src/docs/.eslintrc.js | 42 ++++++++++++++++++++++++++++++++++++++++++ src/docs/package.json | 4 +++- 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/docs/.eslintrc.js diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b58ff18782..4c6398fe8c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -343,6 +343,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.2 @@ -358,6 +359,7 @@ importers: react-dom: 17.0.2_react@17.0.2 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 4938b4e466..9349ef4ddf 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" } } From dcc19c85d2879d12440316fb7f9a9628f87c54c2 Mon Sep 17 00:00:00 2001 From: Cindy Le Date: Sat, 19 Feb 2022 12:24:20 -0500 Subject: [PATCH 2/3] extend correct eslint-config-telescope package and add eslint-plugin-node to eslint package.json --- pnpm-lock.yaml | 28 ++++++++++++++++++++++++++++ src/docs/.eslintrc.js | 2 +- tools/eslint/package.json | 1 + 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4c6398fe8c..861022c9cf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -458,6 +458,7 @@ importers: 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 eslint-plugin-prettier: 3.4.1 eslint-plugin-promise: 5.2.0 eslint-plugin-react: 7.28.0 @@ -472,6 +473,7 @@ importers: eslint-plugin-jest: 25.3.4_cf0e947377590fbec5e3edece1a05d8c eslint-plugin-jest-playwright: 0.2.1 eslint-plugin-jsx-a11y: 6.5.1_eslint@7.32.0 + eslint-plugin-node: 11.1.0_eslint@7.32.0 eslint-plugin-prettier: 3.4.1_6e975bd57c7acf028c1a9ddbbf60c898 eslint-plugin-promise: 5.2.0_eslint@7.32.0 eslint-plugin-react: 7.28.0_eslint@7.32.0 @@ -8510,6 +8512,17 @@ packages: anti-trojan-source: 1.4.0 dev: true + /eslint-plugin-es/3.0.1_eslint@7.32.0: + resolution: {integrity: sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==} + engines: {node: '>=8.10.0'} + peerDependencies: + eslint: '>=4.19.1' + dependencies: + eslint: 7.32.0 + eslint-utils: 2.1.0 + regexpp: 3.2.0 + dev: true + /eslint-plugin-import/2.25.4_eslint@7.32.0: resolution: {integrity: sha512-/KJBASVFxpu0xg1kIBn9AUa8hQVnszpwgE7Ld0lKAlx7Ie87yzEzCgSkekt+le/YVhiaosO4Y14GDAOc41nfxA==} engines: {node: '>=4'} @@ -8579,6 +8592,21 @@ packages: minimatch: 3.1.2 dev: true + /eslint-plugin-node/11.1.0_eslint@7.32.0: + resolution: {integrity: sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==} + engines: {node: '>=8.10.0'} + peerDependencies: + eslint: '>=5.16.0' + dependencies: + eslint: 7.32.0 + eslint-plugin-es: 3.0.1_eslint@7.32.0 + eslint-utils: 2.1.0 + ignore: 5.2.0 + minimatch: 3.0.4 + resolve: 1.22.0 + semver: 6.3.0 + dev: true + /eslint-plugin-prettier/3.4.1_6e975bd57c7acf028c1a9ddbbf60c898: resolution: {integrity: sha512-htg25EUYUeIhKHXjOinK4BgCcDwtLHjqaxCDsMy5nbnUMkKFvIhMVCp+5GFUXQ4Nr8lBsPqtGAqBenbpFqAA2g==} engines: {node: '>=6.0.0'} diff --git a/src/docs/.eslintrc.js b/src/docs/.eslintrc.js index d4f5956afe..38bc4c8e51 100644 --- a/src/docs/.eslintrc.js +++ b/src/docs/.eslintrc.js @@ -1,5 +1,5 @@ module.exports = { - extends: 'eslint-config-telescope', + extends: '@senecacdot/eslint-config-telescope', overrides: [ { diff --git a/tools/eslint/package.json b/tools/eslint/package.json index 3af152fca5..14a46ee299 100644 --- a/tools/eslint/package.json +++ b/tools/eslint/package.json @@ -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", "eslint-plugin-prettier": "3.4.1", "eslint-plugin-promise": "5.2.0", "eslint-plugin-react": "7.28.0", From 102758e013b6acd63fa5d259d9657e568bef070d Mon Sep 17 00:00:00 2001 From: Cindy Le Date: Tue, 22 Feb 2022 13:31:19 -0500 Subject: [PATCH 3/3] rename telescope-docs to @senecacdot/telescope-docs in package.json --- src/docs/.eslintrc.js | 4 ++-- src/docs/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/docs/.eslintrc.js b/src/docs/.eslintrc.js index 38bc4c8e51..9212ff91df 100644 --- a/src/docs/.eslintrc.js +++ b/src/docs/.eslintrc.js @@ -1,6 +1,5 @@ module.exports = { extends: '@senecacdot/eslint-config-telescope', - overrides: [ { files: ['./**/*.js'], @@ -12,6 +11,7 @@ module.exports = { ], 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': [ @@ -33,7 +33,7 @@ module.exports = { settings: { 'import/resolver': { node: { - extensions: ['.js', '.jsx', '.ts', 'tsx'], + extensions: ['.js', '.jsx'], }, }, }, diff --git a/src/docs/package.json b/src/docs/package.json index 9349ef4ddf..be97eb330a 100644 --- a/src/docs/package.json +++ b/src/docs/package.json @@ -1,5 +1,5 @@ { - "name": "telescope-docs", + "name": "@senecacdot/telescope-docs", "version": "0.0.1", "private": true, "scripts": {