Add eslint-plugin-check-file configuration

[MAILPOET-4938]
This commit is contained in:
Jan Jakes
2023-09-26 16:38:06 +02:00
committed by Aschepikov
parent 5688141ffe
commit 4d2ec58b8e
3 changed files with 39 additions and 0 deletions

View File

@ -3,6 +3,7 @@ const FlatCompat = require('@eslint/eslintrc').FlatCompat;
const airbnbConfig = require('eslint-config-airbnb');
const prettierConfig = require('eslint-config-prettier');
const webpackResolver = require('eslint-import-resolver-webpack');
const checkFilePlugin = require('eslint-plugin-check-file');
const noOnlyTestsPlugin = require('eslint-plugin-no-only-tests');
const reactJsxRuntimeConfig = require('eslint-plugin-react/configs/jsx-runtime');
const reactHooksPlugin = require('eslint-plugin-react-hooks');
@ -17,6 +18,8 @@ const prettierCompatConfig = compat.config(prettierConfig);
// TypeError: Key "plugins": Cannot redefine plugin "react"
delete reactJsxRuntimeConfig.plugins.react;
const KEBAB_CASE_PATTERN = '+([a-z])*([a-z0-9])*(-+([a-z0-9]))';
module.exports = [
...airbnbCompatConfig,
reactJsxRuntimeConfig,
@ -33,6 +36,7 @@ module.exports = [
},
plugins: {
'react-hooks': reactHooksPlugin,
'check-file': checkFilePlugin,
'no-only-tests': noOnlyTestsPlugin,
},
rules: {
@ -46,6 +50,15 @@ module.exports = [
'import/extensions': 0, // we wouldn't be able to import jQuery without this line
'import/prefer-default-export': 0, // we want to stop using default exports and start using named exports
'import/no-default-export': 1, // no default exports
'check-file/filename-naming-convention': [
'error',
{ '**/*.*': 'KEBAB_CASE' },
{ ignoreMiddleExtensions: true },
],
'check-file/folder-naming-convention': [
'error',
{ '**/': `@(${KEBAB_CASE_PATTERN}|_stories|_storybook)` },
],
},
},
];