10.24便42日間TIL
eslintを適用してエラーを続け、最後に再び最初から整理します.
1. npx eslint —init To check syntax, find problems, and enforce code style
√ How would you like to use ESLint? · style
√ What type of modules does your project use? · esm
√ Which framework does your project use? · react
√ Does your project use TypeScript? · No
√ Where does your code run? · browser
√ How would you like to define a style for your project? · guide
√ Which style guide do you want to follow? · airbnb
√ What format do you want your config file to be in? · JavaScript
√ Would you like to install them now with npm? · Yes 2. npm install prettier --save-dev --save-exactきれいなnpm取り付け 3. prettierrc.jsonの作成 plugin取付 5. eslintrc.js設定
1. npx eslint —init
√ How would you like to use ESLint? · style
√ What type of modules does your project use? · esm
√ Which framework does your project use? · react
√ Does your project use TypeScript? · No
√ Where does your code run? · browser
√ How would you like to define a style for your project? · guide
√ Which style guide do you want to follow? · airbnb
√ What format do you want your config file to be in? · JavaScript
√ Would you like to install them now with npm? · Yes
// prettierrc.json
{
"arrowParens": "always",
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"bracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 80,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false,
"vueIndentScriptAndStyle": false
}
4. npm install eslint-config-prettier eslint-plugin-prettier --save-dev// eslintrc.js
module.exports = {
env: {
browser: true,
node: true,
es2021: true,
},
extends: [
'plugin:react/recommended',
'airbnb',
'plugin:prettier/recommended',
],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
sourceType: 'module',
},
plugins: ['react', 'prettier'],
rules: {
'react/jsx-filename-extension': [
'error',
{
extensions: ['.js', '.jsx'],
},
],
'prettier/prettier': [
'error',
{
endOfLine: 'auto',
},
],
'no-console': 'off',
},
};
ここまですれば、正常に適用されます.Reference
この問題について(10.24便42日間TIL), 我々は、より多くの情報をここで見つけました https://velog.io/@wswj9608/10.24-항해-43일차-TILテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol