mirror of
https://github.com/logto-io/logto.git
synced 2025-01-13 21:30:30 -05:00
chore(console): disable route component in pages
This commit is contained in:
parent
c96b712a28
commit
f7b8040398
7 changed files with 63 additions and 38 deletions
53
packages/console/.eslintrc.cjs
Normal file
53
packages/console/.eslintrc.cjs
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
// eslint-disable-next-line import/no-extraneous-dependencies -- a transitive dependency of @silverhand/eslint-config
|
||||||
|
const xo = require('eslint-config-xo');
|
||||||
|
|
||||||
|
/** @type {import('eslint').Linter.Config} */
|
||||||
|
module.exports = {
|
||||||
|
extends: '@silverhand/react',
|
||||||
|
parserOptions: {
|
||||||
|
project: ['./tsconfig.json', './tsconfig.scripts.gen.json'],
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'react/function-component-definition': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
namedComponents: 'function-declaration',
|
||||||
|
unnamedComponents: 'arrow-function',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
'import/no-unused-modules': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
unusedExports: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: [
|
||||||
|
'*.d.ts',
|
||||||
|
'**/assets/docs/guides/types.ts',
|
||||||
|
'**/assets/docs/guides/*/index.ts',
|
||||||
|
'**/assets/docs/guides/*/components/**/*.tsx',
|
||||||
|
'**/mdx-components*/*/index.tsx',
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
'import/no-unused-modules': 'off',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['src/pages/**/*.tsx'],
|
||||||
|
rules: {
|
||||||
|
'no-restricted-imports': [
|
||||||
|
...xo.rules['no-restricted-imports'],
|
||||||
|
{
|
||||||
|
name: 'react-router-dom',
|
||||||
|
importNames: ['Route', 'Routes'],
|
||||||
|
message:
|
||||||
|
"Don't use `Route` or `Routes` in pages, add routes to `src/hooks/use-console-routes` instead.",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
|
@ -142,44 +142,6 @@
|
||||||
"@cloud/*": "./src/cloud/$1",
|
"@cloud/*": "./src/cloud/$1",
|
||||||
"@mdx/components/*": "./src/mdx-components/$1"
|
"@mdx/components/*": "./src/mdx-components/$1"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
|
||||||
"extends": "@silverhand/react",
|
|
||||||
"parserOptions": {
|
|
||||||
"project": [
|
|
||||||
"./tsconfig.json",
|
|
||||||
"./tsconfig.scripts.gen.json"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"react/function-component-definition": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"namedComponents": "function-declaration",
|
|
||||||
"unnamedComponents": "arrow-function"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"import/no-unused-modules": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"unusedExports": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": [
|
|
||||||
"*.d.ts",
|
|
||||||
"**/assets/docs/guides/types.ts",
|
|
||||||
"**/assets/docs/guides/*/index.ts",
|
|
||||||
"**/assets/docs/guides/*/components/**/*.tsx",
|
|
||||||
"**/mdx-components*/*/index.tsx"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"import/no-unused-modules": "off"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"stylelint": {
|
"stylelint": {
|
||||||
"extends": "@silverhand/eslint-config-react/.stylelintrc"
|
"extends": "@silverhand/eslint-config-react/.stylelintrc"
|
||||||
},
|
},
|
||||||
|
|
|
@ -6,6 +6,8 @@ import classNames from 'classnames';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { toast } from 'react-hot-toast';
|
import { toast } from 'react-hot-toast';
|
||||||
import { Trans, useTranslation } from 'react-i18next';
|
import { Trans, useTranslation } from 'react-i18next';
|
||||||
|
// FIXME: @yijun
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { Navigate, Route, Routes, useLocation, useParams } from 'react-router-dom';
|
import { Navigate, Route, Routes, useLocation, useParams } from 'react-router-dom';
|
||||||
import useSWR from 'swr';
|
import useSWR from 'swr';
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import { type Organization } from '@logto/schemas';
|
import { type Organization } from '@logto/schemas';
|
||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
// FIXME: @gao
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { Navigate, Route, Routes, useParams } from 'react-router-dom';
|
import { Navigate, Route, Routes, useParams } from 'react-router-dom';
|
||||||
import useSWR from 'swr';
|
import useSWR from 'swr';
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@ import { type OrganizationRole } from '@logto/schemas';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { toast } from 'react-hot-toast';
|
import { toast } from 'react-hot-toast';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
// FIXME: @yijun
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { Navigate, Route, Routes, useParams } from 'react-router-dom';
|
import { Navigate, Route, Routes, useParams } from 'react-router-dom';
|
||||||
import useSWR, { useSWRConfig } from 'swr';
|
import useSWR, { useSWRConfig } from 'swr';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
import Modal from 'react-modal';
|
import Modal from 'react-modal';
|
||||||
|
// FIXME: @charles
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { Navigate, Route, Routes } from 'react-router-dom';
|
import { Navigate, Route, Routes } from 'react-router-dom';
|
||||||
|
|
||||||
import DsModalHeader from '@/ds-components/ModalHeader';
|
import DsModalHeader from '@/ds-components/ModalHeader';
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { useContext, useState } from 'react';
|
import { useContext, useState } from 'react';
|
||||||
|
// FIXME: @charles
|
||||||
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { Route, Routes } from 'react-router-dom';
|
import { Route, Routes } from 'react-router-dom';
|
||||||
import useSWRMutation from 'swr/mutation';
|
import useSWRMutation from 'swr/mutation';
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue