routie dev init since i didn't adhere to any proper guidance up until now
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
import simpleArraySearchRule from './shared/simple-array-search-rule.js';
|
||||
|
||||
const indexOfOverFindIndexRule = simpleArraySearchRule({
|
||||
method: 'findIndex',
|
||||
replacement: 'indexOf',
|
||||
});
|
||||
|
||||
const lastIndexOfOverFindLastIndexRule = simpleArraySearchRule({
|
||||
method: 'findLastIndex',
|
||||
replacement: 'lastIndexOf',
|
||||
});
|
||||
|
||||
/** @type {import('eslint').Rule.RuleModule} */
|
||||
const config = {
|
||||
create(context) {
|
||||
indexOfOverFindIndexRule.listen(context);
|
||||
lastIndexOfOverFindLastIndexRule.listen(context);
|
||||
},
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Prefer `Array#{indexOf,lastIndexOf}()` over `Array#{findIndex,findLastIndex}()` when looking for the index of an item.',
|
||||
recommended: 'unopinionated',
|
||||
},
|
||||
fixable: 'code',
|
||||
hasSuggestions: true,
|
||||
messages: {
|
||||
...indexOfOverFindIndexRule.messages,
|
||||
...lastIndexOfOverFindLastIndexRule.messages,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
Reference in New Issue
Block a user