Skip to content

Commit

Permalink
chore(eslint): comments in config
Browse files Browse the repository at this point in the history
  • Loading branch information
coldlink committed Nov 20, 2024
1 parent 7471d0a commit df21e7a
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const noUnusedVarsPattern = '^_|React|req|res|next|error|idxPaths|Schema$';

const config = tseslint.config(
{
// ignore files we don't want to lint
ignores: [
'**/cdk/',
'**/storybook-static/',
Expand Down Expand Up @@ -39,14 +40,15 @@ const config = tseslint.config(

parserOptions: {
projectService: {
// lint additional files that are not part of the tsconfig
allowDefaultProject: ['eslint.config.mjs', 'cypress.config.ts'],
},
// projectService: true,

ecmaFeatures: {
jsx: true,
},

// list of all tsconfig files that should be used for type checking
project: [
'./tsconfig.json',
'./cypress/tsconfig.json',
Expand All @@ -62,6 +64,7 @@ const config = tseslint.config(
},

rules: {
// fix no-unused-vars errors based on `noUnusedVarsPattern`
'@typescript-eslint/no-unused-vars': [
'error',
{
Expand All @@ -75,22 +78,24 @@ const config = tseslint.config(
},
],

'@typescript-eslint/only-throw-error': 'off',

// override functional rules
'functional/immutable-data': [
'error',
{
ignoreImmediateMutation: true,
},
],

'functional/prefer-immutable-types': 'off',
'functional/type-declaration-immutability': 'off',

// eslint rules
'no-var': 'error',
'no-param-reassign': 'error',
'no-sequences': 'error',
'no-console': 'error',
'prefer-const': 'error',

// disabled @guardian/eslint-config rules, we should enable some of them later
'import/order': 'off',
'@typescript-eslint/consistent-type-imports': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
Expand All @@ -108,16 +113,19 @@ const config = tseslint.config(
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
'import/no-named-as-default-member': 'off',
'import/no-cycle': 'off',
'@typescript-eslint/only-throw-error': 'off',
},
},
{
// rules specific to storybook files
files: ['**/*.stories.tsx'],

rules: {
'functional/immutable-data': 'off',
},
},
{
// rules specific to test files
files: ['**/*.test.tsx', '**/*.test.ts'],

rules: {
Expand All @@ -126,13 +134,15 @@ const config = tseslint.config(
},
},
{
// rules specific to cypress test files
files: ['**/*.cy.ts'],

rules: {
'@typescript-eslint/no-unused-expressions': 'off',
},
},
{
// rules specific to files that are not part of the main codebase
files: [
'__mocks__/**/*',
'.storybook/**/*',
Expand Down

0 comments on commit df21e7a

Please sign in to comment.