Of course, js is recommended as the output format, which is managed by eslint itself, and the output result can be customized according to the program.Įxtends: , It is recommended to select To check syntax, find problems, and enforce code style all three of them directly. You can use ESLint for everything, or you can combine both using Prettier to format your code and ESLint to catch possible errors. Initial configuration eslint ESLint does both traditional linting (looking for problematic patterns) and style checking (enforcement of conventions). The path of the prettier can be set in the settings: npm install -save-dev eslint eslint-plugin-vue prettierĪmong them, eslint-plugin-vue is a Vue-specific lint rule, and there will be corresponding react.Īnd also need to install the corresponding plug-ins in both IDEs Their operation depends on the programs in the node_modules directory, so the npm package installation is a must. IDE plug-ins do not contain the core algorithms of the two formatters, but only provide a bridge to communicate with the IDE. Webstorm comes with eslint, prettier can be searched and installed in settings-plugins (ws seems to have prettier installed by default). If you use vsc, there is no big problem in a short time, but with the upgrade of vsc version, the formatting algorithm may be modified, so it is more reliable to add a prettier. The template part Rely on prettier to unify. He does not care about the indentation of the template part in the Vue file, so if the requirement is for the collaboration of vsc and jb, eslint alone is not enough. Although eslint can also control the code format, it is an ES lint. There is a small question here, is eslint not enough? In some cases, it is not enough. To balance the two IDEs and the uniform format of all developers, it is natural to think of eslint and prettier, which are also very commonly used code management tools in front-end projects. The second case is el-option, even if the IDE format is used again, it is formatted according to this "setting".īut there is no way to configure this indentation in vscode. The first case is el-select as shown in the figure below. Jetbrains will automatically align to the length of the label name if an attribute is added after the html tag name is entered, but if it is directly wrapped without an attribute, it will be positioned to the normal indentation position. Previously explained the difference between eslint and prettier, this time it is to solve the problem of collaboration between VScode and jetbrains IDE.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |