arrow-spacing

在箭头函数中的箭头前后强制保持一致的间距

一些该规则报告的问题可以通过 --fix 命令行选项 自动修复

此规则规范了箭头函数的箭头(=>)之前/之后的间距样式。

/*eslint-env es6*/

// { "before": true, "after": true }
(a) => {}

// { "before": false, "after": false }
(a)=>{}

规则详情

此规则采用具有 beforeafter 属性的对象参数,每个属性都有一个布尔值。

默认配置为 { "before": true, "after": true }

2ivZYOA97rG3AcK+MCMw8p6hmudoTdDkeWe4c8zUJh/gH1YU4V0nH0lTjQ42ufDYCp3bmGhzE9uZuR/i/7GSJ6N7V7C0fW8VXjmJhbv7ooRD9kYTKloopxxFKmNogwtEBO771xZK9h2HYCCLlgDBGA==

fMxAu85BjIe6KL+vThfysZ6hzT287KaXGZcJojyPPhoDCz8pYdyejjBHY98dd/WVALZt8K8P56BV6OgcbabUD5vFmj2qZNXe0YE0c4jKHGvzlNi7DAGg3fgadCWeXmeXbFbZDvFr2nrMdHm4eM0i7g==

/*eslint arrow-spacing: "error"*/
/*eslint-env es6*/

()=> {};
() =>{};
(a)=> {};
(a) =>{};
a =>a;
a=> a;
()=> {'\n'};
() =>{'\n'};

fMxAu85BjIe6KL+vThfysZ6hzT287KaXGZcJojyPPhoDCz8pYdyejjBHY98dd/WVALZt8K8P56BV6OgcbabUD+SXZqyDG0Z/rnMDyrRLoiB0mOwknI/+jhMJ5hilW9LimbO4g8+QtAL4yNQV3oqMww==

/*eslint arrow-spacing: "error"*/
/*eslint-env es6*/

() => {};
(a) => {};
a => a;
() => {'\n'};

yOPmeunUbyT4mmCnPBjZ7ZXd5gpn7jyRDWRnBBI7qLu+FbyDL5jdnn6gE9zgv/7vdW1nQouyYOuAhkZX8anhDakDtksgTOwUb2MHaoO+kstam96FBsIkFIOdBoYvHIDk

/*eslint arrow-spacing: ["error", { "before": false, "after": false }]*/
/*eslint-env es6*/

() =>{};
(a) => {};
()=> {'\n'};

yOPmeunUbyT4mmCnPBjZ7ZXd5gpn7jyRDWRnBBI7qLu+FbyDL5jdnn6gE9zgv/7vdW1nQouyYOuAhkZX8anhDbAX6JAEcFRU3FAB/vMRU0Ac4fylVQsDQu7BzLZHgM6n

/*eslint arrow-spacing: ["error", { "before": false, "after": false }]*/
/*eslint-env es6*/

()=>{};
(a)=>{};
()=>{'\n'};

yOPmeunUbyT4mmCnPBjZ7ZXd5gpn7jyRDWRnBBI7qLu+FbyDL5jdnn6gE9zgv/7vtfGTlu8r3ICz7BWkYlOGHC1Wmc/jKndR+HR8xfc5F63AKubdTcKsgSnqROcL+C0/

/*eslint arrow-spacing: ["error", { "before": false, "after": true }]*/
/*eslint-env es6*/

() =>{};
(a) => {};
()=>{'\n'};

yOPmeunUbyT4mmCnPBjZ7ZXd5gpn7jyRDWRnBBI7qLu+FbyDL5jdnn6gE9zgv/7vtfGTlu8r3ICz7BWkYlOGHHwSh3WbM185Gm+/9aLgLbDf3aXm0/8IxZvk1PVVUSju

/*eslint arrow-spacing: ["error", { "before": false, "after": true }]*/
/*eslint-env es6*/

()=> {};
(a)=> {};
()=> {'\n'};