Closed4
File is a CommonJS module; it may be converted to an ES module
![こばしゅん](https://res.cloudinary.com/zenn/image/fetch/s--ULSOMnc2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_70/https://storage.googleapis.com/zenn-user-upload/avatar/0ed8321b51.jpeg)
.eslintrc.json
を .eslintrc.js
にして書き直すと出てくるこれよくわかってないという備忘録
File is a CommonJS module; it may be converted to an ES module.
jsにして /** @type {import('@typescript-eslint/experimental-utils').TSESLint.Linter.Config} */
みたいなのを使うと型の補完が受けられて便利なので使いたいんよな
![こばしゅん](https://res.cloudinary.com/zenn/image/fetch/s--ULSOMnc2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_70/https://storage.googleapis.com/zenn-user-upload/avatar/0ed8321b51.jpeg)
ちなみに上記は npx create-next-app@latest --typescript
で生成される .eslintrc.json
を書き直した話
書き直し後(WIP)
.eslintrc.js
/** @type {import('@typescript-eslint/experimental-utils').TSESLint.Linter.Config} */
const config = {
extends: [
'plugin:import/typescript',
'plugin:import/warnings',
'next',
'next/core-web-vitals',
'plugin:jsx-a11y/recommended',
'prettier',
],
plugins: ['jsx-a11y', 'testing-library', '@typescript-eslint'],
rules: {
'react/function-component-definition': [2, { namedComponents: 'arrow-function' }],
'no-unused-vars': 0,
'@typescript-eslint/no-unused-vars': 1,
},
overrides: [
{
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
extends: ['plugin:testing-library/react'],
},
],
};
module.exports = config;
![こばしゅん](https://res.cloudinary.com/zenn/image/fetch/s--ULSOMnc2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_70/https://storage.googleapis.com/zenn-user-upload/avatar/0ed8321b51.jpeg)
もしかしてVSCodeの設定の話やったりすんのかな
![こばしゅん](https://res.cloudinary.com/zenn/image/fetch/s--ULSOMnc2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_70/https://storage.googleapis.com/zenn-user-upload/avatar/0ed8321b51.jpeg)
あってた。 .vscode/settings.json
で javascript.suggestionActions.enabled
をfalseにすればいいぽい。
.vscode/settings.json
{
// ...
"javascript.suggestionActions.enabled": false
}
とはいえ根本の問題解決はしてない気がするなー
このスクラップは2022/12/30にクローズされました