Add eslint-plugin-check-file configuration
[MAILPOET-4938]
This commit is contained in:
@ -2,6 +2,7 @@ const babelParser = require('@babel/eslint-parser');
|
|||||||
const FlatCompat = require('@eslint/eslintrc').FlatCompat;
|
const FlatCompat = require('@eslint/eslintrc').FlatCompat;
|
||||||
const airbnbLegacyConfig = require('eslint-config-airbnb/legacy');
|
const airbnbLegacyConfig = require('eslint-config-airbnb/legacy');
|
||||||
const prettierConfig = require('eslint-config-prettier');
|
const prettierConfig = require('eslint-config-prettier');
|
||||||
|
const checkFilePlugin = require('eslint-plugin-check-file');
|
||||||
const importPlugin = require('eslint-plugin-import');
|
const importPlugin = require('eslint-plugin-import');
|
||||||
const noOnlyTestsPlugin = require('eslint-plugin-no-only-tests');
|
const noOnlyTestsPlugin = require('eslint-plugin-no-only-tests');
|
||||||
const globals = require('globals');
|
const globals = require('globals');
|
||||||
@ -11,6 +12,8 @@ const compat = new FlatCompat({ baseDirectory: __dirname });
|
|||||||
const airbnbLegacyCompatConfig = compat.config(airbnbLegacyConfig);
|
const airbnbLegacyCompatConfig = compat.config(airbnbLegacyConfig);
|
||||||
const prettierCompatConfig = compat.config(prettierConfig);
|
const prettierCompatConfig = compat.config(prettierConfig);
|
||||||
|
|
||||||
|
const KEBAB_CASE_PATTERN = '+([a-z])*([a-z0-9])*(-+([a-z0-9]))';
|
||||||
|
|
||||||
module.exports = [
|
module.exports = [
|
||||||
...airbnbLegacyCompatConfig,
|
...airbnbLegacyCompatConfig,
|
||||||
...prettierCompatConfig,
|
...prettierCompatConfig,
|
||||||
@ -26,6 +29,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: {
|
plugins: {
|
||||||
|
'check-file': checkFilePlugin,
|
||||||
import: importPlugin,
|
import: importPlugin,
|
||||||
'no-only-tests': noOnlyTestsPlugin,
|
'no-only-tests': noOnlyTestsPlugin,
|
||||||
},
|
},
|
||||||
@ -34,6 +38,15 @@ module.exports = [
|
|||||||
'no-underscore-dangle': 0, // Backbone uses underscores, we cannot remove them
|
'no-underscore-dangle': 0, // Backbone uses underscores, we cannot remove them
|
||||||
'import/no-default-export': 1, // no default exports
|
'import/no-default-export': 1, // no default exports
|
||||||
'no-only-tests/no-only-tests': 2,
|
'no-only-tests/no-only-tests': 2,
|
||||||
|
'check-file/filename-naming-convention': [
|
||||||
|
'error',
|
||||||
|
{ '**/*.*': 'KEBAB_CASE' },
|
||||||
|
{ ignoreMiddleExtensions: true },
|
||||||
|
],
|
||||||
|
'check-file/folder-naming-convention': [
|
||||||
|
'error',
|
||||||
|
{ '**/': `@(${KEBAB_CASE_PATTERN}|_stories|_storybook)` },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
@ -3,6 +3,7 @@ const FlatCompat = require('@eslint/eslintrc').FlatCompat;
|
|||||||
const airbnbConfig = require('eslint-config-airbnb');
|
const airbnbConfig = require('eslint-config-airbnb');
|
||||||
const prettierConfig = require('eslint-config-prettier');
|
const prettierConfig = require('eslint-config-prettier');
|
||||||
const webpackResolver = require('eslint-import-resolver-webpack');
|
const webpackResolver = require('eslint-import-resolver-webpack');
|
||||||
|
const checkFilePlugin = require('eslint-plugin-check-file');
|
||||||
const noOnlyTestsPlugin = require('eslint-plugin-no-only-tests');
|
const noOnlyTestsPlugin = require('eslint-plugin-no-only-tests');
|
||||||
const reactJsxRuntimeConfig = require('eslint-plugin-react/configs/jsx-runtime');
|
const reactJsxRuntimeConfig = require('eslint-plugin-react/configs/jsx-runtime');
|
||||||
const reactHooksPlugin = require('eslint-plugin-react-hooks');
|
const reactHooksPlugin = require('eslint-plugin-react-hooks');
|
||||||
@ -17,6 +18,8 @@ const prettierCompatConfig = compat.config(prettierConfig);
|
|||||||
// TypeError: Key "plugins": Cannot redefine plugin "react"
|
// TypeError: Key "plugins": Cannot redefine plugin "react"
|
||||||
delete reactJsxRuntimeConfig.plugins.react;
|
delete reactJsxRuntimeConfig.plugins.react;
|
||||||
|
|
||||||
|
const KEBAB_CASE_PATTERN = '+([a-z])*([a-z0-9])*(-+([a-z0-9]))';
|
||||||
|
|
||||||
module.exports = [
|
module.exports = [
|
||||||
...airbnbCompatConfig,
|
...airbnbCompatConfig,
|
||||||
reactJsxRuntimeConfig,
|
reactJsxRuntimeConfig,
|
||||||
@ -33,6 +36,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
plugins: {
|
plugins: {
|
||||||
'react-hooks': reactHooksPlugin,
|
'react-hooks': reactHooksPlugin,
|
||||||
|
'check-file': checkFilePlugin,
|
||||||
'no-only-tests': noOnlyTestsPlugin,
|
'no-only-tests': noOnlyTestsPlugin,
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
@ -46,6 +50,15 @@ module.exports = [
|
|||||||
'import/extensions': 0, // we wouldn't be able to import jQuery without this line
|
'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/prefer-default-export': 0, // we want to stop using default exports and start using named exports
|
||||||
'import/no-default-export': 1, // no default 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)` },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
@ -5,6 +5,7 @@ const airbnbConfig = require('eslint-config-airbnb');
|
|||||||
const airbnbTsConfig = require('eslint-config-airbnb-typescript');
|
const airbnbTsConfig = require('eslint-config-airbnb-typescript');
|
||||||
const prettierConfig = require('eslint-config-prettier');
|
const prettierConfig = require('eslint-config-prettier');
|
||||||
const webpackResolver = require('eslint-import-resolver-webpack');
|
const webpackResolver = require('eslint-import-resolver-webpack');
|
||||||
|
const checkFilePlugin = require('eslint-plugin-check-file');
|
||||||
const noOnlyTestsPlugin = require('eslint-plugin-no-only-tests');
|
const noOnlyTestsPlugin = require('eslint-plugin-no-only-tests');
|
||||||
const reactJsxRuntimeConfig = require('eslint-plugin-react/configs/jsx-runtime');
|
const reactJsxRuntimeConfig = require('eslint-plugin-react/configs/jsx-runtime');
|
||||||
const reactHooksPlugin = require('eslint-plugin-react-hooks');
|
const reactHooksPlugin = require('eslint-plugin-react-hooks');
|
||||||
@ -38,6 +39,8 @@ const prettierCompatConfig = compat.config(prettierConfig);
|
|||||||
// TypeError: Key "plugins": Cannot redefine plugin "react"
|
// TypeError: Key "plugins": Cannot redefine plugin "react"
|
||||||
delete reactJsxRuntimeConfig.plugins.react;
|
delete reactJsxRuntimeConfig.plugins.react;
|
||||||
|
|
||||||
|
const KEBAB_CASE_PATTERN = '+([a-z])*([a-z0-9])*(-+([a-z0-9]))';
|
||||||
|
|
||||||
module.exports = [
|
module.exports = [
|
||||||
...tsRecommendedCompatConfig,
|
...tsRecommendedCompatConfig,
|
||||||
...tsRequiringTypeCheckingCompatConfig,
|
...tsRequiringTypeCheckingCompatConfig,
|
||||||
@ -69,6 +72,7 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
plugins: {
|
plugins: {
|
||||||
'react-hooks': reactHooksPlugin,
|
'react-hooks': reactHooksPlugin,
|
||||||
|
'check-file': checkFilePlugin,
|
||||||
'no-only-tests': noOnlyTestsPlugin,
|
'no-only-tests': noOnlyTestsPlugin,
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
@ -114,6 +118,15 @@ module.exports = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
'check-file/filename-naming-convention': [
|
||||||
|
'error',
|
||||||
|
{ '**/*.*': 'KEBAB_CASE' },
|
||||||
|
{ ignoreMiddleExtensions: true },
|
||||||
|
],
|
||||||
|
'check-file/folder-naming-convention': [
|
||||||
|
'error',
|
||||||
|
{ '**/': `@(${KEBAB_CASE_PATTERN}|_stories|_storybook)` },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user