diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 8159b774..5b4402c0 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,6 +1,12 @@ module.exports = { root: true, - extends: ['plugin:@typescript-eslint/recommended', 'plugin:react-hooks/recommended', 'plugin:ssr-friendly/recommended', 'plugin:storybook/recommended', 'plugin:prettier/recommended'], + extends: [ + 'plugin:@typescript-eslint/recommended', + 'plugin:react-hooks/recommended', + 'plugin:ssr-friendly/recommended', + 'plugin:storybook/recommended', + 'plugin:prettier/recommended', + ], parser: '@typescript-eslint/parser', parserOptions: { ecmaFeatures: { @@ -16,7 +22,10 @@ module.exports = { * Allow empty arrow functions `() => {}`, while keeping other empty functions restricted * @see https://eslint.org/docs/latest/rules/no-empty-function#allow-arrowfunctions */ - '@typescript-eslint/no-empty-function': ['error', { allow: ['arrowFunctions'] }], + '@typescript-eslint/no-empty-function': [ + 'error', + {allow: ['arrowFunctions']}, + ], '@typescript-eslint/ban-ts-comment': 1, 'no-const-assign': 'error', /** Restrict imports from devDependencies since they are not included in library build. peerDependencies are ok */ @@ -24,8 +33,8 @@ module.exports = { 'error', { devDependencies: false, - peerDependencies: true - } + peerDependencies: true, + }, ], /** * Enforce import order with empty lines between import group @@ -38,16 +47,16 @@ module.exports = { 'builtin', 'external', 'internal', - ['parent', 'sibling', 'index'] + ['parent', 'sibling', 'index'], ], pathGroups: [ { pattern: '@/**', - group: 'internal' - } + group: 'internal', + }, ], - 'newlines-between': 'always' - } + 'newlines-between': 'always', + }, ], /** * Disallow combined module and type imports like this `import React, {FC} from 'react'`. @@ -56,27 +65,37 @@ module.exports = { */ '@typescript-eslint/consistent-type-imports': 'error', 'import/no-cycle': 'error', - 'prettier/prettier': ['error', { - "semi": true, - "singleQuote": true, - "jsxSingleQuote": false, - "trailingComma": "es5", - "bracketSpacing": false, - "jsxBracketSameLine": true, - "arrowParens": "avoid" - }] + 'prettier/prettier': [ + 'error', + { + semi: true, + singleQuote: true, + jsxSingleQuote: false, + trailingComma: 'es5', + bracketSpacing: false, + jsxBracketSameLine: true, + arrowParens: 'avoid', + }, + ], }, overrides: [ { /* Allow devDependencies imports for tests and config files */ - files: ['*.js'], + files: ['*.js', '*.cjs'], rules: { '@typescript-eslint/no-var-requires': 0, }, }, { /* Allow devDependencies imports for tests and config files */ - files: ['**/*.spec.*', '**/testUtils/*.*', '**/*.js', '**/setupTests.ts', '**/*.stories.*'], + files: [ + '**/*.spec.*', + '**/testUtils/*.*', + '**/*.js', + '**/*.cjs', + '**/setupTests.ts', + '**/*.stories.*', + ], rules: { 'import/no-extraneous-dependencies': [ 'error', diff --git a/tsconfig.json b/tsconfig.json index 09e0efab..98002b63 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,6 +22,7 @@ }, "include": [ "src", - "**.js" + "**.js", + "**.cjs" ] }