mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
c45a1a5ad4
* refactor(console): safely lazy load pages * chore(console): use react-safe-lazy
62 lines
1.6 KiB
JavaScript
62 lines
1.6 KiB
JavaScript
// 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',
|
|
},
|
|
],
|
|
'react/jsx-pascal-case': ['error', { ignore: ['__Internal__*'] }],
|
|
'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',
|
|
'*.config.js',
|
|
'*.config.ts',
|
|
],
|
|
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.",
|
|
},
|
|
],
|
|
},
|
|
},
|
|
{
|
|
files: ['*.d.ts'],
|
|
rules: {
|
|
'import/no-unassigned-import': 'off',
|
|
},
|
|
},
|
|
],
|
|
};
|