fix: refactor AST parsing for custom ESLint rule
This commit is contained in:
@@ -20,15 +20,12 @@ module.exports = {
|
||||
return {
|
||||
ImportDeclaration(node) {
|
||||
const importPath = node.source.value;
|
||||
if (importPath.startsWith('../')) {
|
||||
const depth = importPath.match(/\.\.\//g).length;
|
||||
if (depth > 2) {
|
||||
if (importPath.startsWith('../../')) {
|
||||
context.report({
|
||||
node,
|
||||
message: 'Importing files more than 2 directories up is not allowed.',
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-react-prefer-function-component": "^3.3.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.5",
|
||||
"eslint-plugin-restrict-import-depth": "file:custom-eslint-rules",
|
||||
"eslint-plugin-restrict-import-depth": "link:./custom-eslint-rules",
|
||||
"eslint-plugin-simple-import-sort": "^12.0.0",
|
||||
"eslint-plugin-storybook": "^0.6.15",
|
||||
"path": "^0.12.7",
|
||||
|
||||
650
pnpm-lock.yaml
generated
650
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@ import createSchedule from '@pages/background/lib/createSchedule';
|
||||
import switchSchedule from '@pages/background/lib/switchSchedule';
|
||||
import type { UserSchedule } from '@shared/types/UserSchedule';
|
||||
import useSchedules from '@views/hooks/useSchedules';
|
||||
import React, { useEffect,useState } from 'react';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
import AddSchedule from '~icons/material-symbols/add';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user