2022-12-21 02:08:20 +03:00
|
|
|
/* eslint-env node */
|
|
|
|
|
|
|
|
require('@uniswap/eslint-config/load')
|
|
|
|
|
2023-05-16 23:53:22 +03:00
|
|
|
const rulesDirPlugin = require('eslint-plugin-rulesdir')
|
|
|
|
rulesDirPlugin.RULES_DIR = 'eslint_rules'
|
|
|
|
|
2022-12-21 02:08:20 +03:00
|
|
|
module.exports = {
|
2023-05-16 23:53:22 +03:00
|
|
|
extends: ['@uniswap/eslint-config/react'],
|
|
|
|
plugins: ['rulesdir'],
|
2023-03-29 23:25:30 +03:00
|
|
|
overrides: [
|
2023-05-02 18:26:07 +03:00
|
|
|
{
|
|
|
|
files: ['**/*'],
|
|
|
|
rules: {
|
|
|
|
'multiline-comment-style': ['error', 'separate-lines'],
|
2023-05-16 23:53:22 +03:00
|
|
|
'rulesdir/enforce-retry-on-import': 'error',
|
2023-05-24 21:31:40 +03:00
|
|
|
'rulesdir/no-undefined-or': 'error',
|
2023-05-02 18:26:07 +03:00
|
|
|
},
|
|
|
|
},
|
2023-04-13 22:43:47 +03:00
|
|
|
{
|
|
|
|
// Configuration/typings typically export objects/definitions that are used outside of the transpiled package
|
|
|
|
// (eg not captured by the tsconfig). Because it's typical and not exceptional, this is turned off entirely.
|
|
|
|
files: ['**/*.config.*', '**/*.d.ts'],
|
|
|
|
rules: {
|
|
|
|
'import/no-unused-modules': 'off',
|
|
|
|
},
|
|
|
|
},
|
2023-03-29 23:25:30 +03:00
|
|
|
{
|
|
|
|
files: ['**/*.ts', '**/*.tsx'],
|
|
|
|
rules: {
|
2023-04-20 23:43:31 +03:00
|
|
|
'import/no-restricted-paths': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
zones: [
|
|
|
|
{
|
|
|
|
target: ['src/**/*[!.test].ts', 'src/**/*[!.test].tsx'],
|
|
|
|
from: 'src/test-utils',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
2023-03-29 23:25:30 +03:00
|
|
|
'no-restricted-imports': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
paths: [
|
2023-04-21 00:12:43 +03:00
|
|
|
{
|
|
|
|
name: 'moment',
|
|
|
|
// tree-shaking for moment is not configured because it degrades performance - see craco.config.cjs.
|
|
|
|
message: 'moment is not configured for tree-shaking. If you use it, update the Webpack configuration.',
|
|
|
|
},
|
2023-03-29 23:25:30 +03:00
|
|
|
{
|
|
|
|
name: 'zustand',
|
|
|
|
importNames: ['default'],
|
|
|
|
message: 'Default import from zustand is deprecated. Import `{ create }` instead.',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2022-12-21 02:08:20 +03:00
|
|
|
}
|