@4-us-4-others/eslint-config 中文文档教程
4 us & 4 others ESLint + Prettier Configuration
Abstract
这些是我们对 ESLint 和 Prettier 的共享设置。 这个 ESLint 配置检查和格式化我们的代码,使其遵循我们共享的风格指南。 它使用 ESLint 来检查和修复 Javascript,并使用 Prettier 来修复问题并很好地格式化我们的代码。 ???
Installation
安装包:
yarn add @4-us-4-others/eslint-config --dev
@4-us-4-others/eslint-config
需要您处理它的 peerDependencies
。 安装每个 peerDependencies
包的正确版本,它们在以下命令中列出:
npx install-peerdeps --dev @4-us-4-others/eslint-config
ESLint Configuration
现在将 @4-us-4-others/eslint-config
添加到您的 .eslintrc.js
:
// .eslintrc.js
module.exports = {
extends: '@4-us-4-others/eslint-config',
}
Prettier Configuration
这是您可以在应用中使用或扩展 @4-us-4-others/eslint-config
Prettier 配置的方式:
// .prettierrc.js
module.exports = require('@4-us-4-others/eslint-config/.prettierrc.js')
// or to override specific options
module.exports = {
...require('@4-us-4-others/eslint-config/.prettierrc.js'),
semi: true,
}
Development
# first, make sure your working tree is clean by committing all your work
# ⚠️ note: you will need to run the following commands with `npm` instead of `yarn`, because yarn 1.x has issues generating the npm registry tokens needed for logging into npm and publishing packages
# preview
npm run publish:preview
# publish to npm
npm run publish
# we use the package "np" to handle publishing to npm
# np will run an interactive publishing tool to guide you through publishing
# np docs: https://github.com/sindresorhus/np
Notes
- The structure of this package is based on
natterstefan/eslint-config-ns
4 us & 4 others ESLint + Prettier Configuration
Abstract
These are our shared settings for ESLint and Prettier. This ESLint configuration lints and formats our code so it follows our shared style guide. It uses ESLint to lint and fix Javascript, and Prettier to fix issues and format our code nicely. ????
Installation
Install the package with:
yarn add @4-us-4-others/eslint-config --dev
@4-us-4-others/eslint-config
requires you to take care of it's peerDependencies
. Install the correct version of each peerDependencies
package, which are listed with the following command:
npx install-peerdeps --dev @4-us-4-others/eslint-config
ESLint Configuration
Now add @4-us-4-others/eslint-config
to your .eslintrc.js
:
// .eslintrc.js
module.exports = {
extends: '@4-us-4-others/eslint-config',
}
Prettier Configuration
This is how you can use or extend the @4-us-4-others/eslint-config
Prettier config in your app:
// .prettierrc.js
module.exports = require('@4-us-4-others/eslint-config/.prettierrc.js')
// or to override specific options
module.exports = {
...require('@4-us-4-others/eslint-config/.prettierrc.js'),
semi: true,
}
Development
# first, make sure your working tree is clean by committing all your work
# ⚠️ note: you will need to run the following commands with `npm` instead of `yarn`, because yarn 1.x has issues generating the npm registry tokens needed for logging into npm and publishing packages
# preview
npm run publish:preview
# publish to npm
npm run publish
# we use the package "np" to handle publishing to npm
# np will run an interactive publishing tool to guide you through publishing
# np docs: https://github.com/sindresorhus/np
Notes
- The structure of this package is based on
natterstefan/eslint-config-ns