![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
arui-presets-lint
Advanced tools
Набор общих конфигурационных файлов для валидации react/node/typescript-проектов.
Как я могу улучшить стандарты?
Установить библиотеку в проект нужно как dev dependency:
yarn add -D arui-presets-lint
⚠️ С версии 8.0.0 библиотеке более не требуется установка peer dependency подробнее
Далее произвести следующие настройки:
package.json
:{
"prettier": "arui-presets-lint/prettier",
"eslintConfig": {
"extends": "./node_modules/arui-presets-lint/eslint"
},
"stylelint": {
"extends": "arui-presets-lint/stylelint"
},
"commitlint": {
"extends": "./node_modules/arui-presets-lint/commitlint"
}
}
package.json
:{
"scripts": {
"lint:styles": "arui-presets-lint styles",
"lint:scripts": "arui-presets-lint scripts",
"format": "arui-presets-lint format",
"format:check": "arui-presets-lint format:check",
"lint": "yarn lint:styles && yarn lint:scripts && yarn format:check",
"lint:fix": "yarn lint:styles --fix && yarn lint:scripts --fix && yarn format"
}
}
Чтобы eslint / stylelint / prettier не проверял конкретные файлы и папки, можно исключить их с помощью файлов .eslintignore / .stylelintignore / .prettierignore. Прописывать там файлы, которые уже есть в .gitignore не требуется!
Для запуска eslint/stylelint рекомендуется использовать флаг --max-warnings, который позволяет ограничить количество возникающих предупреждений.
Пример такой конфигурации:
{
"scripts": {
"lint:styles": "arui-presets-lint styles --max-warnings=0",
"lint:scripts": "arui-presets-lint scripts --max-warnings=0",
...
}
}
При установке библиотеки в корне проекта создался файл lefthook.yml, он должен содержать следующее:
extends:
- ./node_modules/arui-presets-lint/lefthook/index.yml
Этот конфиг можно расширить специфичными для вашего проекта настройками, см. документацию Примеры такого расширения:
extends:
- ./node_modules/arui-presets-lint/lefthook/index.yml
pre-commit:
commands:
# Добавить сборку typescript на pre-commit:
check-ts:
run: npx --no-install tsc --noEmit
# Запустить тесты, относящиеся к измененному файлу:
run-tests:
glob: '*.{js,ts,jsx,tsx,mts,mjs,cjs,cts}'
run: npx --no-install jest --findRelatedTests --passWithNoTests {staged_files}
pre-push:
commands:
# Запустить команду 'lint' на pre-push:
run-lint:
run: yarn lint
Так как yarn run
в yarn 2+ не поддерживает возможность запускать бинарные файлы, которые не установлены как прямые зависимости, а yarn dlx
не умеет запускать бинарники без скачивания его из npm, существует возможность это сделать через вызов npx --no-install ...
:
# Применить конфигурацию lefthook:
npx --no-install lefthook install
# Вызов prettier, для того чтобы отформатировать только js и jsx файлы:
npx --no-install prettier --write "./**/*.{js,jsx}" --no-error-on-unmatched-pattern --cache
# Вызов eslint, для того чтобы проверить только js и jsx файлы:
npx --no-install eslint "**/*.{js,jsx}" --ext .js,.jsx --ignore-pattern=.gitignore,.eslintignore --cache --cache-location="./node_modules/.cache/eslint/.eslintcache"
Таким образом можно гибко настраивать поведение линтеров для вашего проекта, если по какой-то причине стандартная конфигурация вам не подходит.
Если нужно увидеть в консоли чему именно соответствует алиас в cli-утилите, нужно запустить arui-presets-lint с флагом --echo, например:
yarn arui-presets-lint --echo format
# >> prettier --write "./**/*.{ts,tsx,js,jsx,mjs,mts,cjs,cts,css,json}" --no-error-on-unmatched-pattern --cache
Если нужно посмотреть, какой именно конфиг применяется в текущем проекте:
# eslint:
npx --no-install eslint --print-config file.tsx > eslintconfig.json
# stylelint:
npx --no-install stylelint --print-config file.css > stylelintconfig.json
# commitlint:
npx --no-install commitlint --print-config > commitlintconfig.txt
Данный проект использует semantic-release.
Выпуск новой версии происходит с помощью Github Actions, используйте джобу Create new library package
. Для beta-версии используется ветка beta
, для релизной - master
.
The MIT License (MIT)
Copyright (c) 2024 core-ds contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
FAQs
Config files for arui-apps
The npm package arui-presets-lint receives a total of 597 weekly downloads. As such, arui-presets-lint popularity was classified as not popular.
We found that arui-presets-lint demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.