Skip to content

Commit

Permalink
Small changes to base,react,jest configs
Browse files Browse the repository at this point in the history
  • Loading branch information
burtek committed May 15, 2023
1 parent ea0643f commit deed228
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
5 changes: 3 additions & 2 deletions configs/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ export function prepareConfig() {
ignoreRegExpLiterals: true
}],
'max-statements-per-line': 'error',
'multiline-comment-style': 'error',
'multiline-ternary': ['error', 'always-multiline'],
'new-cap': 'error',
'newline-per-chained-call': 'error',
Expand Down Expand Up @@ -285,6 +284,7 @@ export function prepareConfig() {
'groups': [
'builtin',
'external',
'internal',
['parent', 'sibling'],
'index'
],
Expand Down Expand Up @@ -322,7 +322,8 @@ export function prepareConfig() {
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
'@typescript-eslint/consistent-type-imports': ['error', {
prefer: 'type-imports',
fixStyle: 'separate-type-imports'
fixStyle: 'separate-type-imports',
disallowTypeAnnotations: false
}],
'@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'no-public' }],
'@typescript-eslint/member-delimiter-style': 'error',
Expand Down
6 changes: 5 additions & 1 deletion configs/jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ export function prepareConfig({ mode = 'jest' } = {}) {
languageOptions: {
globals: {
...globals.jest,
...globals.node
...globals.node,
...(mode === 'vitest' && {
jest: 'off',
vitest: 'readonly'
})
}
},
settings: {
Expand Down
13 changes: 10 additions & 3 deletions configs/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const linkComponents = [
];

const files = ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'];
const testFiles = ['**/*.test.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'];
const tsFiles = ['**/*.{ts,cts,mts,tsx}'];
const jsxFiles = ['**/*.{jsx,tsx}'];

/**
* @param {Object} [config]
Expand Down Expand Up @@ -136,20 +139,24 @@ export function prepareConfig({ a11y = false, nextjs = false } = {}) {
}
},
{
files: ['**/*.{ts,cts,mts,tsx}'],
files: tsFiles,
rules: { '@typescript-eslint/naming-convention': /** @type {any} */(['error']).concat(reactNamingRuleConfig) }
},
{
files: testFiles,
rules: { 'react-hooks/rules-of-hooks': 'off' }
}
]);
const nextConfig = defineFlatConfig([
{
files: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'],
files,
plugins: { '@next/next': next },
rules: { ...next.configs.recommended.rules }
}
]);
const a11yConfig = defineFlatConfig([
{
files: ['**/*.{jsx,tsx}'],
files: jsxFiles,
plugins: { 'jsx-a11y': jsxA11y },
rules: { ...jsxA11y.configs.recommended.rules }
}
Expand Down

0 comments on commit deed228

Please sign in to comment.