Мне нравится использовать свои пользовательские правила для линового производства, и предпочитаю использовать как Eslint, так и красивее (имеет автоматический формат в коде VS). Некоторые из правил конфликтуют друг с другом, например, @stylistic/js/ray-bracket-oversing Правило конфликты с красивым. В кодовой строке const t = ['t']; , если я не заполняю правило расстояния массивов , то VS-код выбрасывает ошибку. Пространство требуется после '['. Eslint (@stylistic/js/ray-brackcet-incession) и если я это сделаю, то он бросает ошибку Delete '·' Eslint (более красивое/красивое) . Как установить правила Eslint. Переопределение более красивых правил? < /P>
prettier.config.mjs:
/** @type {import("prettier").Options} */
const config = {
arrowParens: "avoid",
bracketSameLine: false,
bracketSpacing: true,
endOfLine: "auto",
printWidth: 110,
proseWrap: "preserve",
semi: true,
singleAttributePerLine: false,
singleQuote: false,
tabWidth: 2,
trailingComma: "none",
useTabs: true
};
export default config;
< /code>
eslint.config.mjs:
import eslint from "@eslint/js";
import json from "@eslint/json";
import pluginJs from "@stylistic/eslint-plugin-js";
import pluginJsx from "@stylistic/eslint-plugin-jsx";
import pluginTs from "@stylistic/eslint-plugin-ts";
import eslintConfigPrettier from "eslint-config-prettier";
import deprecation from "eslint-plugin-deprecation";
import pluginImport from "eslint-plugin-import";
import jest from "eslint-plugin-jest";
import preferArrow from "eslint-plugin-prefer-arrow";
import eslintPluginPrettier from "eslint-plugin-prettier";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
import tseslint from "typescript-eslint";
import pretterConfig from "./prettier.config.mjs";
export default tseslint.config(
eslintConfigPrettier,
eslintPluginPrettierRecommended,
eslint.configs.recommended,
tseslint.configs.eslintRecommended,
...tseslint.configs.recommended,
{ ignores: ["build", "coverage", "dist", "node_modules"] },
{
languageOptions: {
parser: tseslint.parser,
parserOptions: {
ecmaFeatures: {
jsx: true
},
ecmaVersion: 2020,
project: ["./tsconfig.json"],
sourceType: "module"
}
},
plugins: {
prettier: eslintPluginPrettier,
"@stylistic/js": pluginJs,
"@stylistic/jsx": pluginJsx,
"@stylistic/ts": pluginTs,
"@typescript-eslint": tseslint.plugin,
deprecation: deprecation,
import: pluginImport,
jest: jest,
json: json,
"prefer-arrow": preferArrow
}
},
{
files: ["**/*.js", "**/*.mjs", "**/*.ts", "**/*.tsx"],
rules: {
"prettier/prettier": ["error", pretterConfig],
"@stylistic/js/array-bracket-spacing": [ "error", "always"],
...
}
},
...
);
< /code>
package.json:
{
...
"devDependencies": {
"@eslint/js": "8.57.0",
"@eslint/json": "0.5.0",
"@stylistic/eslint-plugin-js": "2.8.0",
"@stylistic/eslint-plugin-jsx": "2.9.0",
"@stylistic/eslint-plugin-ts": "2.8.0",
"@typescript-eslint/eslint-plugin": "8.5.0",
"@typescript-eslint/eslint-plugin-tslint": "7.0.2",
"@typescript-eslint/parser": "8.5.0",
"eslint": "8.57.0",
"eslint-config-prettier": "8.10.0",
"eslint-plugin-deprecation": "3.0.0",
"eslint-plugin-import": "2.31.0",
"eslint-plugin-jest": "28.8.3",
"eslint-plugin-prefer-arrow": "1.2.3",
"eslint-plugin-prettier": "5.2.1",
"prettier": "3.0.0",
"prettier-eslint": "15.0.1",
"stylelint": "16.9.0",
"stylelint-config-standard": "36.0.1",
"stylelint-scss": "6.7.0",
"typescript": "4.9.5",
"typescript-eslint": "8.5.0",
},
...
}
Подробнее здесь: https://stackoverflow.com/questions/794 ... n-prettier
Установить Eslint более приоритет, чем красивее ⇐ Javascript
Форум по Javascript
-
Anonymous
1739880775
Anonymous
Мне нравится использовать свои пользовательские правила для линового производства, и предпочитаю использовать как Eslint, так и красивее (имеет автоматический формат в коде VS). Некоторые из правил конфликтуют друг с другом, например, @stylistic/js/ray-bracket-oversing Правило конфликты с красивым. В кодовой строке const t = ['t']; , если я не заполняю правило расстояния массивов , то VS-код выбрасывает ошибку. Пространство требуется после '['. Eslint (@stylistic/js/ray-brackcet-incession) и если я это сделаю, то он бросает ошибку Delete '·' Eslint (более красивое/красивое) . Как установить правила Eslint. Переопределение более красивых правил? < /P>
prettier.config.mjs:
/** @type {import("prettier").Options} */
const config = {
arrowParens: "avoid",
bracketSameLine: false,
bracketSpacing: true,
endOfLine: "auto",
printWidth: 110,
proseWrap: "preserve",
semi: true,
singleAttributePerLine: false,
singleQuote: false,
tabWidth: 2,
trailingComma: "none",
useTabs: true
};
export default config;
< /code>
eslint.config.mjs:
import eslint from "@eslint/js";
import json from "@eslint/json";
import pluginJs from "@stylistic/eslint-plugin-js";
import pluginJsx from "@stylistic/eslint-plugin-jsx";
import pluginTs from "@stylistic/eslint-plugin-ts";
import eslintConfigPrettier from "eslint-config-prettier";
import deprecation from "eslint-plugin-deprecation";
import pluginImport from "eslint-plugin-import";
import jest from "eslint-plugin-jest";
import preferArrow from "eslint-plugin-prefer-arrow";
import eslintPluginPrettier from "eslint-plugin-prettier";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
import tseslint from "typescript-eslint";
import pretterConfig from "./prettier.config.mjs";
export default tseslint.config(
eslintConfigPrettier,
eslintPluginPrettierRecommended,
eslint.configs.recommended,
tseslint.configs.eslintRecommended,
...tseslint.configs.recommended,
{ ignores: ["build", "coverage", "dist", "node_modules"] },
{
languageOptions: {
parser: tseslint.parser,
parserOptions: {
ecmaFeatures: {
jsx: true
},
ecmaVersion: 2020,
project: ["./tsconfig.json"],
sourceType: "module"
}
},
plugins: {
prettier: eslintPluginPrettier,
"@stylistic/js": pluginJs,
"@stylistic/jsx": pluginJsx,
"@stylistic/ts": pluginTs,
"@typescript-eslint": tseslint.plugin,
deprecation: deprecation,
import: pluginImport,
jest: jest,
json: json,
"prefer-arrow": preferArrow
}
},
{
files: ["**/*.js", "**/*.mjs", "**/*.ts", "**/*.tsx"],
rules: {
"prettier/prettier": ["error", pretterConfig],
"@stylistic/js/array-bracket-spacing": [ "error", "always"],
...
}
},
...
);
< /code>
package.json:
{
...
"devDependencies": {
"@eslint/js": "8.57.0",
"@eslint/json": "0.5.0",
"@stylistic/eslint-plugin-js": "2.8.0",
"@stylistic/eslint-plugin-jsx": "2.9.0",
"@stylistic/eslint-plugin-ts": "2.8.0",
"@typescript-eslint/eslint-plugin": "8.5.0",
"@typescript-eslint/eslint-plugin-tslint": "7.0.2",
"@typescript-eslint/parser": "8.5.0",
"eslint": "8.57.0",
"eslint-config-prettier": "8.10.0",
"eslint-plugin-deprecation": "3.0.0",
"eslint-plugin-import": "2.31.0",
"eslint-plugin-jest": "28.8.3",
"eslint-plugin-prefer-arrow": "1.2.3",
"eslint-plugin-prettier": "5.2.1",
"prettier": "3.0.0",
"prettier-eslint": "15.0.1",
"stylelint": "16.9.0",
"stylelint-config-standard": "36.0.1",
"stylelint-scss": "6.7.0",
"typescript": "4.9.5",
"typescript-eslint": "8.5.0",
},
...
}
Подробнее здесь: [url]https://stackoverflow.com/questions/79448206/set-eslint-higher-priority-than-prettier[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия