Skip to content

Commit

Permalink
[ESLint] Enable prefer-arrow-callback in the base configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Pewtro committed Jul 16, 2024
1 parent ba0156e commit 9daf3e7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/cyan-games-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@putstack/eslint-config-typescript': minor
---

Enable prefer-arrow-callback in the base configuration
18 changes: 11 additions & 7 deletions packages/eslint-config-typescript/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,24 @@ import sonar from 'eslint-plugin-sonarjs';
import tseslint, { config } from 'typescript-eslint';

//General eslint recommended rules
const eslintConfig = config(eslint.configs.recommended);
const eslintConfig = config(eslint.configs.recommended, {
rules: {
/** Code quality rules */
//Enforce default clauses in switch statements to be last
'default-case-last': 'warn',
//Disallow nested ternary expressions
'no-nested-ternary': 'warn',
//Prefer the arrow callback of ES6 where possible
'prefer-arrow-callback': 'warn',
},
});

//General typescript-eslint rules that have type knowledge
const typescriptEslintConfig = config(
...tseslint.configs.recommendedTypeChecked,
...tseslint.configs.stylisticTypeChecked,
{
rules: {
/** Code quality rules */
//Enforce default clauses in switch statements to be last
'default-case-last': 'warn',
//Disallow nested ternary expressions
'no-nested-ternary': 'warn',

/** Rules that need to be turned off in default eslint to be turned on in Typescript ESLint */
//Enforce default parameters to be last
'@typescript-eslint/default-param-last': 'warn',
Expand Down

0 comments on commit 9daf3e7

Please sign in to comment.