반응형
오류: /Users/name/Desktop/blognewtonmcvue/store에서 ESLint 구성을 찾을 수 없음
eslint에 이 오류가 있다.나는 vue/vuex와 함께 일하고 있다.이건 내 스택 트레이스야
> Module build failed (from ./node_modules/eslint-loader/index.js):
> Error: No ESLint configuration found in
> /Users/name/Desktop/blognewtonmcvue/store.
> at CascadingConfigArrayFactory._finalizeConfigArray (/Users/anme/Desktop/blognewtonmcvue/mevnexample/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:432:19)
> at CascadingConfigArrayFactory.getConfigArrayForFile (/Users/name/Desktop/blognewtonmcvue/mevnexample/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js:271:21)
> at CLIEngine.isPathIgnored (/Users/name/Desktop/blognewtonmcvue/mevnexample/node_modules/eslint/lib/cli-engine/cli-engine.js:951:18)
> at CLIEngine.executeOnText (/Users/name/Desktop/blognewtonmcvue/mevnexample/node_modules/eslint/lib/cli-engine/cli-engine.js:868:38)
> at lint (/Users/name/Desktop/blognewtonmcvue/mevnexample/node_modules/eslint-loader/index.js:278:17)
> at transform (/Users/name/Desktop/blognewtonmcvue/mevnexample/node_modules/eslint-loader/index.js:252:18)
> at /Users/name/Desktop/blognewtonmcvue/mevnexample/node_modules/loader-fs-cache/index.js:127:18
> at ReadFileContext.callback (/Users/name/Desktop/blognewtonmcvue/mevnexample/node_modules/loader-fs-cache/index.js:31:14)
> at FSReqCallback.readFileAfterOpen [as oncomplete] (node:fs:273:13)
내가 시도한 해결책 중 하나는
eslint --init
그리고 이 파일을 받았어:
eslintrc.js.
module.exports = {
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:vue/essential"
],
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"vue"
],
"rules": {
}
};
그러나 오류는 내 스토어 파일 posts.js와 store.js를 가리킨다.
포스트 js
import axios from "axios";
import vuex from "vuex";
const state = {
posts: [],
};
const getters = {
allPosts: (state) => state.Posts,
};
const actions = {
//an action: makes a request, gets a response and calls a mutation
async fetchPosts({ commit }) {
// commit - to call the mutation
const response = await axios.get("http://localhost:4000/posts");
commit("setPosts", response.data);
},
async addPosts({ commit }, title) {
const response = await axios.post("http://localhost:4000/posts/add", {
title,
completed: false,
});
commit("newPost", response.data);
},
async deletePosts({ commit }, id) {
await axios.delete(`http://localhost:4000/posts/delete/${id}`);
commit("removePosts", id);
},
async filterPosts({ commit }, e) {
//Get selected number
// const limit = parseInt(e.target.options[e.target.options.selectedIndex].innerText);
const limit = e.target.value;
const response = await axios.get(`http://localhost:4000/posts`);
commit("setPosts", response.data);
},
async updatePosts({ commit }, updatePosts) {
const response = await axios.put(
`http://localhost:4000/posts/update/${this.$route.params.id}`,
updatePosts
);
console.log(response.data);
commit("updatePosts", response.data);
},
};
const mutations = {
setPost: (state, posts) => (state.posts = posts),
newPost: (state, posts) => state.posts.unshift(posts),
removePost: (state, id) =>
(state.posts = state.posts.filter((posts) => posts.id !== id)),
updatePosts: (state, updPosts) => {
const index = state.Posts.findIndex((posts) => posts.id === updPosts.id);
if (index !== -1) {
state.posts.splice(index, 1, updPosts);
}
},
};
export default {
state,
getters,
actions,
mutations,
};
//this is a boilerplate for vuex module
이건 내 다른 파일이야store.js 및 post.js 파일 모두 디렉토리/맵 "store"에 있음
store.js.
import Vuex from "vuex";
import Vue from "vue";
import store from "./post";
//load Vuex
Vue.use(Vuex);
//create store
export default new Vuex.Store({
modules: {
post,
},
});
내 프로젝트에는 babel.config.js .eslintrc.js가 있다.
나는 이 단계를 통해 이 문제를 해결했다.
- npm eslint 제거(버전이 잘못되었기 때문에)
- npm install eslint@7.11.0(es2021을 지원했기 때문에 이 작업을 수행함) 이 단계가 작동하지 않으면 github에서 프로젝트를 다시 복제해 보십시오.
반응형
'Programing' 카테고리의 다른 글
Jest를 사용하여 VueJS 구성 요소의 사용자 지정 모듈 조롱 (0) | 2022.04.12 |
---|---|
VueJS/VueX 최대 통화 스택 크기를 초과함 (0) | 2022.04.12 |
vuex의 "모사" 돌연변이 (0) | 2022.04.12 |
VueJS + VUEX + 소방 기지:소방 기지를 어디에 설치할 것인가? (0) | 2022.04.12 |
VueJS에서 v-for 지시문을 사용하여 여러 루트 요소를 렌더링하는 방법 (0) | 2022.04.12 |