Merge newsletter tests config into ES5 config
[MAILPOET-5015]
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
const es5Config = require('@mailpoet/eslint-config/eslint-es5.config');
|
||||
const es6Config = require('@mailpoet/eslint-config/eslint-es6.config');
|
||||
const esTsConfig = require('@mailpoet/eslint-config/eslint-ts.config');
|
||||
const esTestsNewsletterEditorConfig = require('@mailpoet/eslint-config/eslint-tests-newsletter-editor.config');
|
||||
const globals = require('@mailpoet/eslint-config/globals');
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
@ -12,7 +12,10 @@ module.exports = [
|
||||
},
|
||||
...es5Config.map((config) => ({
|
||||
...config,
|
||||
files: ['assets/js/src/**/*.js'],
|
||||
files: [
|
||||
'assets/js/src/**/*.js',
|
||||
'tests/javascript_newsletter_editor/**/*.js',
|
||||
],
|
||||
})),
|
||||
...es6Config.map((config) => ({
|
||||
...config,
|
||||
@ -22,10 +25,19 @@ module.exports = [
|
||||
...config,
|
||||
files: ['assets/js/src/**/*.{ts,tsx}'],
|
||||
})),
|
||||
...esTestsNewsletterEditorConfig.map((config) => ({
|
||||
...config,
|
||||
|
||||
// ES5 config overrides
|
||||
{
|
||||
files: ['tests/javascript_newsletter_editor/**/*.js'],
|
||||
})),
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.mocha,
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
'func-names': 0,
|
||||
},
|
||||
},
|
||||
|
||||
// ES6 config overrides
|
||||
{
|
||||
|
@ -3,6 +3,7 @@ const FlatCompat = require('@eslint/eslintrc').FlatCompat;
|
||||
const airbnbLegacyConfig = require('eslint-config-airbnb/legacy');
|
||||
const prettierConfig = require('eslint-config-prettier');
|
||||
const importPlugin = require('eslint-plugin-import');
|
||||
const noOnlyTestsPlugin = require('eslint-plugin-no-only-tests');
|
||||
const globals = require('globals');
|
||||
|
||||
// compat configs
|
||||
@ -26,11 +27,13 @@ module.exports = [
|
||||
},
|
||||
plugins: {
|
||||
import: importPlugin,
|
||||
'no-only-tests': noOnlyTestsPlugin,
|
||||
},
|
||||
rules: {
|
||||
'import/prefer-default-export': 0, // we want to stop using default exports and start using named exports
|
||||
'no-underscore-dangle': 0, // Backbone uses underscores, we cannot remove them
|
||||
'import/no-default-export': 1, // no default exports
|
||||
'no-only-tests/no-only-tests': 2,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
@ -1,40 +0,0 @@
|
||||
const babelParser = require('@babel/eslint-parser');
|
||||
const FlatCompat = require('@eslint/eslintrc').FlatCompat;
|
||||
const airbnbLegacyConfig = require('eslint-config-airbnb/legacy');
|
||||
const prettierConfig = require('eslint-config-prettier');
|
||||
const importPlugin = require('eslint-plugin-import');
|
||||
const noOnlyTestsPlugin = require('eslint-plugin-no-only-tests');
|
||||
const globals = require('globals');
|
||||
|
||||
// compat configs
|
||||
const compat = new FlatCompat({ baseDirectory: __dirname });
|
||||
const airbnbLegacyCompatConfig = compat.config(airbnbLegacyConfig);
|
||||
const prettierCompatConfig = compat.config(prettierConfig);
|
||||
|
||||
module.exports = [
|
||||
...airbnbLegacyCompatConfig,
|
||||
...prettierCompatConfig,
|
||||
{
|
||||
languageOptions: {
|
||||
parser: babelParser,
|
||||
parserOptions: {
|
||||
ecmaVersion: 6,
|
||||
sourceType: 'module',
|
||||
},
|
||||
globals: {
|
||||
...globals.mocha,
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
import: importPlugin,
|
||||
'no-only-tests': noOnlyTestsPlugin,
|
||||
},
|
||||
rules: {
|
||||
'no-only-tests/no-only-tests': 2,
|
||||
// Exceptions
|
||||
'func-names': 0,
|
||||
// Temporary
|
||||
'no-underscore-dangle': 0,
|
||||
},
|
||||
},
|
||||
];
|
Reference in New Issue
Block a user