๋ชฉ์ฐจ (OPEN)
- ๐ ๋ค์ด๊ฐ๋ฉฐ
- ๐ฅ MODULE_TYPELESS_PACKAGE_JSON ๊ฒฝ๊ณ
- ๐ง A config object is using the "extends" key ์๋ฌ
- ๐จ React version not specified ๊ฒฝ๊ณ
- ๐ฉ babel.config.js: 'module' is not defined
- ๐ฆ React Hooks / Refresh๊ฐ Flat Config์์ ๋์ ์ ํจ
- ๐ช lint ์คํํ๋๋ฐ ์๋ฌด ๊ท์น์ด ์ ์ฉ๋์ง ์์
- โฌ ์ต์ข ์ค์ ํ์ผ

๐ ๋ค์ด๊ฐ๋ฉฐ
์์ ํฌ์คํ ์์ ์์๋ดค๋ฏ์ด
ESLint v9๋ถํฐ ๊ธฐ์กด์ .eslintrc๋ ์ ์ ์ง์์ด ์ข
๋ฃ๋๊ณ ,
์๋ก์ด Flat Config ๋ฐฉ์ (eslint.config.js)์ ์ฌ์ฉํด์ผ ํ๋ค.
์ด๋ฒ์ ๋์๋ฆฌ์์ ์ ํ๋ก์ ํธ๋ฅผ ์์ํ๋ฉด์
Expo + React Native ํ๊ฒฝ์ ๋ง์ถฐ ESLint๋ฅผ ๋ฏธ๋ฆฌ ์ธํ
ํด๋๋ ค๊ณ ํ๋๋ฐ ,,
Expo + React Native ํ๊ฒฝ์์๋ ์ด๋ป๊ฒ ํด์ผํ๋์ง ์ ๋ฆฌํด ๋ ๋ธ๋ก๊ทธ๊ฐ ๋ฑํ ์์ด์
์ค์ ํ๋ ๋ฐ ์ฌ๋ฌ ์๋ฌ๋ค์ด ์๊พธ ๋์ ์๋นํ ํ๊ฐ ๋ฌ์๋ค ,, ^^ ,,๐คฏ
๊ทธ๋์ ์ดํ์ ํน์ ์ค์ ํ์ค ๋ถ๋ค์ด ์ฐธ๊ณ ํ ์ ์๋๋ก
์งง๊ฒ๋๋ง ๋ฐ์ํ๋ ์๋ฌ๋ค์ ์ด๋ป๊ฒ ์์ ํ๋์ง ์ ๋ฆฌํด๋๊ณ ์ ํ๋ค.
๐ฅ MODULE_TYPELESS_PACKAGE_JSON ๊ฒฝ๊ณ
Warning: Module type of file:///.../eslint.config.js is not specified
๐ก ์์ธ
eslint.config.js ๋ด๋ถ์ ES Module ๋ฌธ๋ฒ์ ์ฐ๋ฉด
Node๊ฐ “์ด ํ์ผ ESM์ธ์ง CJS์ธ์ง ๋ชจ๋ฅด๊ฒ ์” ํ๊ณ ๊ฒฝ๊ณ ๋ฅผ ๋์ฐ๋ ๊ฒ์ด๋ค.
(์ฆ, ํ์ผ์ ๋ชจ๋ ํ์ ์ด ๋ช ํํ์ง ์์์ ์๊ธฐ๋ ๋ฌธ์ ์ด๋ค.)
โ ํด๊ฒฐ
Flat Config๋ CommonJS๋ก ์์ฑํ๋ ๊ฒ ๊ฐ์ฅ ์์ ์ ์ด๋ผ๊ณ ํ๋ค.
๊ทธ๋์ ํ์ผ๋ช ์ .cjs๋ก ๋ฐ๊พธ๊ณ require ๋ฐฉ์์ผ๋ก ์์ฑํด์ฃผ๋ ๊ฒฝ๊ณ ๊ฐ ์ฌ๋ผ๋ค.
// eslint.config.cjs ๋ก ์์ฑ
const js = require("@eslint/js");
๐ ์ฐธ๊ณ
์ฌ์ค ์ฒ์์๋ package.json์ ์๋์ฒ๋ผ "type": "module"์ ์ถ๊ฐํด์
ESM์ผ๋ก ๊ฐ์ ์ธ์์ํค๋ ๋ฐฉํฅ์ผ๋ก ์ ๊ทผํ์๋ค.
"type": "module"
ํ์ง๋ง ์ด๋ ๊ฒ ๋ณ๊ฒฝํ๋ ESM ๊ด๋ จ ์ค๋ฅ๋ค์ด ์ฐ์์ ์ผ๋ก ํฐ์ง๊ธฐ ์์ํ๊ณ ,
Expo + RN ํ๊ฒฝ์์๋ ๊ทธ ์๋ฌ๋ค์ ํ๋์ฉ ํด๊ฒฐํ๋ ๊ฒ์ด ํจ์ฌ ๋ ๊น๋ค๋ก์ ๋ค.
๊ทธ๋์ ์ข ๋ ๊ฒ์ํด๋ณด๋, React Native ๊ธฐ๋ฐ ํ๋ก์ ํธ์์๋
CJS ๋ฐฉ์์ผ๋ก Flat Config๋ฅผ ๊ตฌ์ฑํ๋ ์ฌ๋ก๊ฐ ํจ์ฌ ๋ง๊ณ , ๋ ์์ ์ ์ด๋ผ๋ ์ ์ ํ์ธํ๋ค.
๊ทธ๋์ ๊ตณ์ด ESM์ ๊ณ ์งํ ํ์๊ฐ ์๋ค๋ ๊ฒฐ๋ก ์ ๋ด๋ฆฌ๊ณ , ๊น๋ํ๊ฒ CJS๋ก ๊ฒฐ์ ํ๋ค ๐ค
๐ง A config object is using the "extends" key ์๋ฌ
A config object is using the "extends" key, which is not supported in flat config system.
๐ก ์์ธ
Flat Config์์๋ ๋ ์ด์ "extends"๋ฅผ ์ฌ์ฉํ ์ ์์ด์ ๋ฐ์ํ๋ ์๋ฌ์ด๋ค.
(์ฆ, ๊ธฐ์กด .eslintrc ๋ฐฉ์์ ํ์ฅ ๊ตฌ์กฐ๊ฐ Flat Config์์๋ ์์ ํ ์ ๊ฑฐ๋์๊ธฐ ๋๋ฌธ์ ๋ฐ์ํ๋ ์ค๋ฅ๋ค.)
โ ํด๊ฒฐ
๊ธฐ์กด์ ์๋์ ๊ฐ์ด ์์ฑํ์๋ ์ฝ๋๋ฅผ
extends: ["eslint:recommended", "plugin:react/recommended"];
์ด๋ ๊ฒ ์๋์ฒ๋ผ ์๋์ฒ๋ผ ๊ฐ ํ๋ฌ๊ทธ์ธ์ preset์ ๋ฐฐ์ด๋ก ์ง์ ๋์ดํด์ฃผ๋ ๋ฐฉ์์ผ๋ก ๋ฐ๊พธ์ด์ฃผ์๋ค.
module.exports = [
js.configs.recommended,
reactPlugin.configs.flat.recommended,
...
];
๐จ React version not specified ๊ฒฝ๊ณ
Warning: React version not specified in eslint-plugin-react settings.
๐ก ์์ธ
Flat Config ๊ตฌ์กฐ์์๋ settings๊ฐ ์ต์๋จ์ผ๋ก ๋ถ๋ฆฌ๋ผ ์์ด์
eslint-plugin-react์ react.version ์๋ ๊ฐ์ง๊ฐ ์ ๋๋ก ์ ๋๋ ๊ฒฝ์ฐ๊ฐ ๋ง๋ค๊ณ ํ๋ค.
๊ทธ๋์ React ๋ฒ์ ์ ๋ช ์ํ์ง ์์ผ๋ฉด ์์ ๊ฐ์ ๊ฒฝ๊ณ ๊ฐ ๋ฐ์ํ๋ค.
โ ํด๊ฒฐ
์ ๊ฐ๋จํ ๊ทธ๋ฅ ๋ช ์์ ์ผ๋ก ์ ์ด์ฃผ๊ธฐ๋ง ํ๋ฉด ๋์ด๋ค.
settings: {
react: {
version: "19.1.0", // ๊ฐ์ ๋ฒ์ ์ ๋ง๊ฒ ์์์ ,,
},
}
๐ฉ babel.config.js: 'module' is not defined
'module' is not defined no-undef
๐ก ์์ธ
babel.config.js๋ ๋ฌด์กฐ๊ฑด CJS ๋ฌธ๋ฒ์ ์ฌ์ฉํด์ผ ํ๋๋ฐ,
ํ์ง๋ง ESLint๋ ๊ธฐ๋ณธ์ ์ผ๋ก CJS ์ ์ญ(module, require)์ ๋ชจ๋ฅด๊ธฐ ๋๋ฌธ์ ๋ฐ์ํ๋ ์๋ฌ์ด๋ค.
(์ฆ, Babel์ CJS ํ์ผ์ธ๋ฐ ESLint๋ ESM ๊ธฐ์ค์ผ๋ก ๊ฒ์ฌํด์ ์ถฉ๋ํ๋ ์ํฉ์ด๋ค.)
โ ํด๊ฒฐ
๊ทธ๋ฅ ESLint ์ค์ ํ๋จ์๋ค๊ฐ babel.config.js์ ๋ฐ๋ก ๋นผ์ ignore ์ฒ๋ฆฌ ํด์ฃผ์๋ค.
{
files: ["babel.config.js"],
languageOptions: {
globals: {
module: "readonly",
require: "readonly",
},
},
rules: {},
}
์ด๋ ๊ฒ ํ๋ฉด Babel ์ค์ ํ์ผ๋ง ์์ธ์ ์ผ๋ก ์ ์ ๊ฒ์ฌ๋๋ฉฐ,
Flat Config์ ๋๋จธ์ง ๊ท์น๊ณผ๋ ์ถฉ๋ํ์ง ์๋๋ค.
๐ฆ React Hooks / Refresh๊ฐ Flat Config์์ ๋์ ์ ํจ
๐ก ์์ธ
Flat Config์์๋ ๊ธฐ์กด .eslintrc์ฒ๋ผ
plugins: ["react", "react-hooks", ...] ๊ฐ์ ๋ฌธ์์ด ๊ธฐ๋ฐ ํ๋ฌ๊ทธ์ธ ์ ์ธ์ด ์ง์๋์ง ์๋๋ค.
๋์ , ํ๋ฌ๊ทธ์ธ์ ๋ฐ๋์ ๊ฐ์ฒด ํํ๋ก ์ง์ ๋ฑ๋กํด์ผ๋ง ์ ์ ๋์ํ๊ธฐ ๋๋ฌธ์
๋ฌธ์์ด๋ก ๋ฃ์ผ๋ฉด ํ๋ฌ๊ทธ์ธ์ ์ฝ์ง ๋ชปํด Hooks ๊ท์น๊ณผ Refresh ๊ท์น์ด ์ ํ ์ ์ฉ๋์ง ์๋ ๊ฒ์ด๋ค.
โ ํด๊ฒฐ
ํ๋ฌ๊ทธ์ธ์ ์๋์ฒ๋ผ ๊ฐ์ฒด ํํ๋ก ๋ช ์์ ์ผ๋ก ์ ์ธํด์ฃผ๋ฉด ๋๋ค.
plugins: {
react: reactPlugin,
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
๐ช lint ์คํํ๋๋ฐ ์๋ฌด ๊ท์น์ด ์ ์ฉ๋์ง ์์
๐ก ์์ธ
์ผ๋ฐ ๊ท์น๋ณด๋ค ํ์ฅ ๊ท์น(js.configs.recommended ๋ฑ)์ ๋จผ์ ๋ฃ์ด์ผ ํด์ ๋ฐ์ํ๋ ๋ฌธ์ ๋ผ๊ณ ํ๋ค.
์์๊ฐ ๋ค๋ฐ๋๋ฉด ํ์ฅ preset์ด ๋ฎ์ด์ฐ์ด์ง ๋ชปํ๊ณ ,
๊ฒฐ๊ณผ์ ์ผ๋ก ESLint๊ฐ ๊ท์น์ ์ ๋๋ก ๋ก๋ฉํ์ง ๋ชปํด ์๋ฌด ๊ท์น๋ ์ ์ฉ๋์ง ์๋ ์ํ๊ฐ ๋๊ธฐ ๋๋ฌธ์ด๋ค.
โ ํด๊ฒฐ
๋ฐ๋ผ์ ๊ทธ๋ฅ ์๋์ ๊ฐ์ ์์๋ก ๋ฐ๊ฟ์ฃผ๊ธฐ๋ง ํ ๋ฐ๋ก ํด๊ฒฐ๋๋ค.
module.exports = [
{ ignores: [...] },
// ํ์ฅ config ๋จผ์
js.configs.recommended,
reactPlugin.configs.flat.recommended,
eslintConfigPrettier,
// ๊ทธ๋ค์์ ๋ด ๊ท์น
{
files: ["**/*.{js,jsx}"],
rules: { ... }
}
];
์ฐธ๊ณ ๋ก, Flat Config๋ ๋ฐฐ์ด์ ์์์ ์๋๋ก ์์ฐจ์ ์ผ๋ก ๋ณํฉํ๊ธฐ ๋๋ฌธ์
์ด ์์๋ฅผ ์ง์ผ์ผ ๋ชจ๋ ๊ท์น์ด ์ ์์ ์ผ๋ก ์ ์ฉ๋๋ค๊ณ ํ๋ค.
โฌ ์ต์ข ์ค์ ํ์ผ
๋ด๊ฐ ์ฌ์ฉ ์ค์ธ ์ค์ ์ ๋ค์๊ณผ ๊ฐ๋ค.
(์ฌ์ฉํ๋ค๊ฐ ๋ณ๊ฒฝ์ด ์๊ธธ ์๋ ์๋๋ฐ, ๊ทธ๋ผ ์ถํ ์์ ํ๋ฌ ์ค๊ฒ ์ต๋๋น ,,๐คง)
const js = require("@eslint/js");
const eslintConfigPrettier = require("eslint-config-prettier");
const reactPlugin = require("eslint-plugin-react");
const reactHooks = require("eslint-plugin-react-hooks");
const reactRefresh = require("eslint-plugin-react-refresh");
const globals = require("globals");
module.exports = [
{
settings: {
react: {
version: "19.1.0",
},
},
ignores: [
"node_modules",
"dist",
"build",
"coverage",
"android",
"ios",
".expo",
".expo-shared",
],
},
js.configs.recommended,
reactPlugin.configs.flat.recommended,
eslintConfigPrettier,
{
files: ["**/*.{js,jsx}"],
languageOptions: {
ecmaVersion: 2020,
sourceType: "module",
globals: {
...globals.browser,
...globals.es2021,
__DEV__: "readonly",
},
},
plugins: {
react: reactPlugin,
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
rules: {
// ์ฝ์์ ๊ฒฝ๊ณ ๋ง
"no-console": ["warn", { allow: ["warn", "error"] }],
"no-debugger": "error",
// ์ต์ React + RN์์ ํ์ ์๋ ๊ท์น ๋๊ธฐ
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
// react-hooks ์ถ์ฒ ๊ท์น ์ง์ ์ถ๊ฐ
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
// react-refresh ๊ธฐ๋ณธ ๊ถ์ฅ ๊ท์น ์ง์ ์ถ๊ฐ
"react-refresh/only-export-components": "warn",
// ์ ์ฐ๋ ๋ณ์ ๊ฒฝ๊ณ ์์๋ก ๊บผ๋
// (๊ฐ๋ฐ ๋๋๋ฉด ๋ค์ ํฌ๊ฑฐ๋๊น ์ต๋ํ ์ ์ฐ๊ฒ ํ์ธ์ !!)
"no-unused-vars": "off",
},
},
{
files: ["babel.config.js"],
languageOptions: {
globals: {
module: "readonly",
require: "readonly",
},
},
rules: {},
},
];
'๐ป๊ณต๋ถ ๊ธฐ๋ก > ๐ Frontend' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| [Frontend] React Native์์ ์์ฐ์ค๋ฌ์ด scroll fade ๊ตฌํํ๊ธฐ - MaskedView (0) | 2025.11.24 |
|---|---|
| [Frontend] 3D ๋ก๊ณ ํ์ด๋์ธ ์ต์ ํ (0) | 2025.11.14 |
| [Frontend] ๋ธ๋ ๋์์ ๋ชจ๋ธ ์ ์ํ๊ณ ์น์ผ๋ก ๋์ฐ๊ธฐ (1) | 2025.11.14 |
| [Frontend] ESLint v9๋ก TS+React ๋ฆฐํ ํ๊ฒฝ ๋ง๋ค๊ธฐ (0) | 2025.11.12 |
| [Frontend] ESLint v9 ๊ณต์ ๋ฌธ์ ๋ฏ์ด๋ณด๊ธฐ (0) | 2025.11.12 |