我是否正确地说,不可能使用 eslint插件与tslint?
我尝试将它添加到我的tslint.json中:
"plugins": ["react-hooks"],
"rules: {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
但是,我在控制台中看到了以下错误:
Could not find implementations for the following rules
尝试调用useEffect钩子内的redux操作创建器时出现以下警告- React Hook useEffect has a missing dependency: 'getPlanQuotes'. Either include it or remove the dependency array react-hooks/exhaustive-deps 这是useEffect钩子- const { getPlanQuotes } = props;
useEffect(() => {
getPlanQuotes();
}, []); 所以我试着用// eslint
我使用的是VSCode,当我将行'react-hooks/exhaustive-deps': 'warn'添加到我的.eslintrc.js中时,会在ESLint输出中得到以下内容:
Rules with suggestions must set the `meta.hasSuggestions` property to `true`. Occurred while linting
C:\Users\filepath.jsx:72 Rule: "react-hooks/exhaustive-deps"
这就破坏了所有其他的皮毛。我尝试在我的.es
npm启动后,我看到错误,当它出现时,网页是空白的:
[frontend] Line 21:6: React Hook useEffect has a missing dependency: 'register'. Either include it or remove the dependency array react-hooks/exhaustive-deps
[frontend]
[frontend] ./src/components/user/findProperty/FindProperty.js
[frontend] Line 47:6: Reac
我使用useEffect钩子来调用动作创建者props.getStoreItems。我得到了下面的重复错误
React Hook useEffect has a missing dependency: 'props'.
Either include it or remove the dependency array react-hooks/exhaustive-deps.
这是我的代码:
function GetStoreData(props) {
useEffect(() => {
const {storeType} = props;
let u
我似乎无法找到正确的方法来解决这个问题。想要得到警告的乘坐,而不是让内联忽略警告评论。可能useCallback正朝着解决方案的方向发展。我只想检查一次功能组件是否被初始化,如果商店需要,有条件的。仅此而已。
Line 72:6: React Hook useEffect has missing dependencies: 'dispatch' and 'storedSlugItems'. Either include them or remove the dependency array react-hooks/exhaustive-deps
useEff
我有一个问题,原因是ESLINT输出控制台中的一个错误。我想解决控制台中的问题。请检查这里的代码框
更新问题
The 'callbackFunction' function makes the dependencies of useEffect Hook (at line 33) change on every render. Move it inside the useEffect callback. Alternatively, wrap the definition of 'callbackFunction' in its own useCallback
使用Reactive16.8.6(在以前的16.8.3版本中很好),当我试图阻止获取请求上的无限循环时,我会得到这个错误:
./src/components/BusinessesList.js
Line 51: React Hook useEffect has a missing dependency: 'fetchBusinesses'.
Either include it or remove the dependency array react-hooks/exhaustive-deps
我一直无法找到阻止无限循环的解决方案。我想远离使用useReducer()。我确实
我有一个名为useInitial的钩子,定义为
function useInitial(value) {
const ref = useRef();
// Store current value in ref
useEffect(() => {
ref.current = value;
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
// Return previous value (happens before update in useEffect above)
我得到了这个错误,我真的不能解决它: src/api/ConnectApi.js
Line 25:8: React Hook useEffect has missing dependencies: 'apiurl', 'dataState', and 'fetch'. Either include them or remove the dependency array. You can also do a functional update 'setDataState(d => ...)' if you only n
我的组件有三个属性。urlText是一个字符串,setSelectedText是从connect()和clearPage更新状态的redux操作,后者是清除状态的另一个redux操作。 我只想在urlText更改时更新状态。我想在卸载时清除状态。 I get this eslint warning `react-hooks/exhaustive-deps: React Hook useEffect has missing dependencies: setSelectedText`
warning `react-hooks/exhaustive-deps: React Hook use
我收到了这些小错误
./components/create-nft/InstagramSelector.js
39:15 Warning: Effect callbacks are synchronous to prevent race conditions. Put the async function inside:
useEffect(() => {
async function fetchData() {
// You can await here
const response = await MyAPI.getData(someId);
// .
下面的代码触发了一个标准的default-case lint错误,但是没有触发@typescript-eslint/switch-exhaustiveness-check。知道是什么导致的吗?其他@类型记录
type Day = 'Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday' | 'Saturday' | 'Sunday';
const day = 'Monday' as Day;
let res
我试图使用Next.js为IPFS创建一个产品构建,当我试图运行yarn build时会遇到以下错误:
68:8 Warning: React Hook useEffect has a missing dependency: 'updateUI'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
./components/ManualHeader.jsx
16:8 Warning: React Hook useEffect has a missing depend
我在useEffect钩子中做一个fetch请求。这是它看起来的样子。 useEffect(() => {
// clear prev state
setUniqueValues([]);
setLoading(true);
// get unique values and set field values;
jwtAxios
.post(`${baseURL}/support/get_unique_values`, {
field: fieldName,
catalog_id: