@arabasta/eslint-plugin-javascript
Javascript 规则的 ESLint 插件 .
安装
假设您已经安装了 ESLint, 请运行 :
# npm
npm install --save-dev @arabasta/eslint-plugin-javascript
# yarn
yarn add --dev @arabasta/eslint-plugin-javascript
# pnpm
pnpm add --save-dev @arabasta/eslint-plugin-javascript
使用量
平面配置 (单位:千美元)互联网档案馆的存檔,存档日期2013-12-02(中文(简体) )
// ...
import arabastaJavascript from '@arabasta/eslint-plugin-javascript';
export default [
// ...
arabastaJavascript.configs.recommended,
];
遗产配置 (单位:千美元).slintrc (英语)(中文(简体) )
{
"extends": [
// ...
"plugin:@arabasta/javascript/recommended-legacy"
]
}
规则
QQ 配置启用 .
设置在 recommended 配置 .
自动修复 --fix CLI 选项。 。 。 .
手动修复 编辑器建议。 。 。 .
| 名称 | 说明 | 💼 | 🔧 | 💡 |
|---|---|---|---|---|
| 报告错误 | 要求报告被捕获出错 | ✅ | 💡 | |
| 替代函数 | 需要使用替代功能 | 🔧 |
设置
您可以在配置中设置以下设置:
@arabasta/alternative-functions
从替代函数组名称到一系列替代函数的地图.
此设置目前仅用于 替代函数 规则作为替代规则 规则选项 因为我们想要多个配置添加自己的选项 - 这个特性是 无法 在当前的斯林特.
interface AlternativeFunction {
/**
* The name of the function that will be replaced by the alternative (`to`) function.
*/
from: string;
/**
* The name of the alternative function that will replace the `from` function.
*/
to: string;
}
interface Settings {
'@arabasta/alternative-functions': {
/**
* The key of the object that holds the array of alternative functions is
* recommended to be used as a description of the group of alternative functions.
* Note: The key should be distinctive enough so that it won't be overwritten by other configs.
*/
[key?: string]: AlternativeFunction[];
};
}
const exampleSettings: Settings = {
'@arabasta/alternative-functions': {
redux: [
{
from: 'useDispatch',
to: 'useAppDispatch',
},
{
from: 'useSelector',
to: 'useAppSelector',
},
],
'redux-thunk': [
{
from: 'createAsyncThunk',
to: 'createAppAsyncThunk',
},
],
},
};