From 27fba621c50654e8c6f2350f3ba7aad75eb7f94a Mon Sep 17 00:00:00 2001 From: Cindy Le Date: Thu, 17 Feb 2022 16:26:06 -0500 Subject: [PATCH] add eslint to Docusaurus and play together with turborepo's linting --- pnpm-lock.yaml | 68 +++++++++++++++++++++---------------------- src/docs/.eslintrc.js | 42 ++++++++++++++++++++++++++ src/docs/package.json | 4 ++- 3 files changed, 78 insertions(+), 36 deletions(-) create mode 100644 src/docs/.eslintrc.js diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9f0605ff51..c67adcd426 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -149,7 +149,7 @@ importers: env-cmd: 10.1.0 nodemon: 2.0.15 dependencies: - '@senecacdot/satellite': 1.24.0 + '@senecacdot/satellite': 1.25.0 devDependencies: env-cmd: 10.1.0 nodemon: 2.0.15 @@ -161,7 +161,7 @@ importers: got: 11.8.3 nodemon: 2.0.15 dependencies: - '@senecacdot/satellite': 1.24.0 + '@senecacdot/satellite': 1.25.0 cheerio: 1.0.0-rc.10 got: 11.8.3 devDependencies: @@ -176,7 +176,7 @@ importers: nodemon: 2.0.15 sharp: 0.29.3 dependencies: - '@senecacdot/satellite': 1.24.0 + '@senecacdot/satellite': 1.25.0 celebrate: 15.0.1 got: 11.8.3 sharp: 0.29.3 @@ -197,7 +197,7 @@ importers: dependencies: '@elastic/elasticsearch': 7.16.0 '@elastic/elasticsearch-mock': 0.3.1 - '@senecacdot/satellite': 1.24.0 + '@senecacdot/satellite': 1.25.0 bull: 3.29.3 bull-board: 2.1.3 jsdom: 18.1.1 @@ -212,7 +212,7 @@ importers: express-handlebars: 5.3.5 nodemon: 2.0.15 dependencies: - '@senecacdot/satellite': 1.24.0 + '@senecacdot/satellite': 1.25.0 express: 4.17.2 express-handlebars: 5.3.5 devDependencies: @@ -230,7 +230,7 @@ importers: normalize-url: 6.1.0 supertest: 6.1.6 dependencies: - '@senecacdot/satellite': 1.24.0 + '@senecacdot/satellite': 1.25.0 bull: 3.29.3 express-validator: 6.14.0 ioredis: 4.28.2 @@ -246,7 +246,7 @@ importers: express-validator: 6.14.0 nodemon: 2.0.15 dependencies: - '@senecacdot/satellite': 1.24.0 + '@senecacdot/satellite': 1.25.0 express-validator: 6.14.0 devDependencies: nodemon: 2.0.15 @@ -265,7 +265,7 @@ importers: passport: 0.5.2 passport-saml: 3.2.0 dependencies: - '@senecacdot/satellite': 1.24.0 + '@senecacdot/satellite': 1.25.0 '@supabase/supabase-js': 1.29.4 celebrate: 15.0.1 connect-redis: 6.0.0 @@ -304,7 +304,7 @@ importers: '@octokit/plugin-retry': 3.0.9 '@octokit/plugin-throttling': 3.5.2_@octokit+core@3.5.1 '@popperjs/core': 2.10.2 - '@senecacdot/satellite': 1.24.0 + '@senecacdot/satellite': 1.25.0 bootstrap: 5.1.3_@popperjs+core@2.10.2 express: 4.17.2 express-handlebars: 6.0.2 @@ -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: @@ -431,7 +433,7 @@ importers: shelljs: 0.8.5 dependencies: '@octokit/webhooks': 9.15.0 - '@senecacdot/satellite': 1.24.0 + '@senecacdot/satellite': 1.25.0 date-fns: 2.26.0 dotenv: 10.0.0 merge-stream: 2.0.0 @@ -3811,6 +3813,18 @@ packages: - supports-color dev: false + /@elastic/elasticsearch/7.17.0: + resolution: {integrity: sha512-5QLPCjd0uLmLj1lSuKSThjNpq39f6NmlTy9ROLFwG5gjyTgpwSqufDeYG/Fm43Xs05uF7WcscoO7eguI3HuuYA==} + engines: {node: '>=12'} + dependencies: + debug: 4.3.3 + hpagent: 0.1.2 + ms: 2.1.3 + secure-json-parse: 2.4.0 + transitivePeerDependencies: + - supports-color + dev: false + /@emotion/hash/0.8.0: resolution: {integrity: sha512-kBJtf7PH6aWwZ6fka3zQ0p6SBYzx4fl1LoZXE2RrnYST9Xljm7WfKJrU4g/Xr3Beg72MLrp1AWNUmuYJTL7Cow==} dev: false @@ -4655,11 +4669,11 @@ packages: rollup: 2.64.0 dev: false - /@senecacdot/satellite/1.24.0: - resolution: {integrity: sha512-LC5Dhe+oV3hICw6f8w7pJNc0QdD+uQo3wGuDf/GjOri+mIgOxsPBWTXBPv6pc4LEoP9mUTUrKHI9MDP4ExLbLA==} + /@senecacdot/satellite/1.25.0: + resolution: {integrity: sha512-n0oMoY/d3uaweAww5UonRbDQLngxVdeCK+IEnl4DYLhuaHWYxztlRgLJ+PVHTTliilyy+XUYsF2TnwHd32AmCw==} engines: {node: '>=14.0.0', pnpm: '>=6'} dependencies: - '@elastic/elasticsearch': 7.16.0 + '@elastic/elasticsearch': 7.17.0 '@elastic/elasticsearch-mock': 0.3.1 '@godaddy/terminus': 4.10.2 cors: 2.8.5 @@ -4667,8 +4681,8 @@ packages: express-jwt: 6.1.0 helmet: 4.6.0 http-errors: 1.8.1 - ioredis: 4.28.3 - ioredis-mock: 5.9.1_ioredis@4.28.3 + ioredis: 4.28.5 + ioredis-mock: 5.9.1_ioredis@4.28.5 jsonwebtoken: 8.5.1 node-fetch: 2.6.7 pino: 7.6.5 @@ -6060,14 +6074,6 @@ packages: postcss-value-parser: 4.2.0 dev: false - /aws-sign2/0.7.0: - resolution: {integrity: sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=} - dev: true - - /aws4/1.11.0: - resolution: {integrity: sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==} - dev: true - /axe-core/4.4.1: resolution: {integrity: sha512-gd1kmb21kwNuWr6BQz8fv6GNECPBnUasepcoLbekws23NVBLODdsClRZ+bQ8+9Uomf3Sm3+Vwn0oYG9NvwnJCw==} engines: {node: '>=4'} @@ -9175,10 +9181,6 @@ packages: rimraf: 3.0.2 dev: true - /flatstr/1.0.12: - resolution: {integrity: sha512-4zPxDyhCyiN2wIAtSLI6gc82/EjqZc1onI4Mz/l0pWrAlsSfYH/2ZIcU+e3oA2wDwbzIWNKwa23F8rh6+DRWkw==} - dev: false - /flatted/3.2.5: resolution: {integrity: sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==} dev: true @@ -9230,10 +9232,6 @@ packages: signal-exit: 3.0.6 dev: true - /forever-agent/0.6.1: - resolution: {integrity: sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=} - dev: true - /fork-ts-checker-webpack-plugin/6.5.0_webpack@5.68.0: resolution: {integrity: sha512-cS178Y+xxtIjEUorcHddKS7yCMlrDPV31mt47blKKRfMd70Kxu5xruAFE2o9sDY6wVC5deuob/u/alD04YYHnw==} engines: {node: '>=10', yarn: '>=1.0.0'} @@ -10265,7 +10263,7 @@ packages: standard-as-callback: 2.1.0 dev: false - /ioredis-mock/5.9.1_ioredis@4.28.3: + /ioredis-mock/5.9.1_ioredis@4.28.5: resolution: {integrity: sha512-ZirdGJFOqH5nP8FYXuHUJmexvtZ6r2Ybc5alaGMzt38QA0kse5/rYnBQcb4ofxkyqzhXHuaCsXiwLlfG6NyhhQ==} engines: {node: '>=10'} peerDependencies: @@ -10274,7 +10272,7 @@ packages: dependencies: fengari: 0.1.4 fengari-interop: 0.1.3_fengari@0.1.4 - ioredis: 4.28.3 + ioredis: 4.28.5 lodash: 4.17.21 standard-as-callback: 2.1.0 dev: false @@ -10298,8 +10296,8 @@ packages: - supports-color dev: false - /ioredis/4.28.3: - resolution: {integrity: sha512-9JOWVgBnuSxpIgfpjc1OeY1OLmA4t2KOWWURTDRXky+eWO0LZhI33pQNT9gYxANUXfh5p/zYephYni6GPRsksQ==} + /ioredis/4.28.5: + resolution: {integrity: sha512-3GYo0GJtLqgNXj4YhrisLaNNvWSNwSS2wS4OELGfGxH8I69+XfNdnmV1AyN+ZqMh0i7eX+SWjrwFKDBDgfBC1A==} engines: {node: '>=6'} dependencies: cluster-key-slot: 1.1.0 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" } }