Rewrite .eslintrc.tests_newsletter_editor.js to new config format
[MAILPOET-5015]
This commit is contained in:
@ -1,6 +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');
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
@ -18,4 +19,9 @@ module.exports = [
|
||||
...config,
|
||||
files: ['assets/js/src/**/*.{ts,tsx}'],
|
||||
})),
|
||||
...esTestsNewsletterEditorConfig.map((config) => ({
|
||||
...config,
|
||||
files: ['tests/javascript_newsletter_editor/**/*.js'],
|
||||
ignores: ['tests/javascript_newsletter_editor/testBundles/**'],
|
||||
})),
|
||||
];
|
||||
|
@ -4,8 +4,7 @@
|
||||
"extends @wordpress/browserslist-config"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint --max-warnings 0 'assets/js/src/**' && pnpm run lint-tests",
|
||||
"lint-tests": "ESLINT_USE_FLAT_CONFIG=false eslint -c ../packages/js/eslint-config/.eslintrc.tests_newsletter_editor.js --max-warnings 0 'tests/javascript_newsletter_editor'",
|
||||
"lint": "eslint --max-warnings 0 'assets/js/src/**' 'tests/javascript_newsletter_editor/**'",
|
||||
"autoprefixer": "postcss assets/dist/css/*.css --use autoprefixer --no-map --replace",
|
||||
"scss": "sass assets/css/src/:assets/dist/css/ --style compressed",
|
||||
"stylelint": "stylelint --fix",
|
||||
@ -19,8 +18,7 @@
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{scss,css}": "pnpm run stylelint",
|
||||
"!(*spec).{js,jsx,ts,tsx}": "eslint --max-warnings 0",
|
||||
"**/newsletter_editor/**/*spec.js": "ESLINT_USE_FLAT_CONFIG=false eslint -c ../packages/js/eslint-config/.eslintrc.tests_newsletter_editor.js --max-warnings 0",
|
||||
"*.{js,jsx,ts,tsx}": "eslint --max-warnings 0",
|
||||
"*.php": [
|
||||
"phplint",
|
||||
"./do qa:code-sniffer",
|
||||
|
@ -1,20 +0,0 @@
|
||||
module.exports = {
|
||||
extends: ['airbnb/legacy', 'prettier'],
|
||||
env: {
|
||||
amd: true,
|
||||
mocha: true,
|
||||
},
|
||||
parser: '@babel/eslint-parser',
|
||||
parserOptions: {
|
||||
ecmaVersion: 6,
|
||||
sourceType: 'module',
|
||||
},
|
||||
rules: {
|
||||
'no-only-tests/no-only-tests': 2,
|
||||
// Exceptions
|
||||
'func-names': 0,
|
||||
// Temporary
|
||||
'no-underscore-dangle': 0,
|
||||
},
|
||||
plugins: ['no-only-tests'],
|
||||
};
|
@ -0,0 +1,40 @@
|
||||
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