2018-11-13 19:21:04 +00:00
|
|
|
module.exports = {
|
2021-01-05 13:58:18 +00:00
|
|
|
extends: [
|
|
|
|
'plugin:@woocommerce/eslint-plugin/recommended',
|
|
|
|
'plugin:you-dont-need-lodash-underscore/compatible',
|
|
|
|
],
|
2018-11-13 19:21:04 +00:00
|
|
|
globals: {
|
2021-04-22 11:37:27 +00:00
|
|
|
wcBlocksMiddlewareConfig: 'readonly',
|
2020-06-10 18:21:34 +00:00
|
|
|
fetchMock: true,
|
2020-07-14 19:46:44 +00:00
|
|
|
jQuery: 'readonly',
|
2020-08-20 14:14:12 +00:00
|
|
|
IntersectionObserver: 'readonly',
|
2020-09-07 17:31:10 +00:00
|
|
|
// @todo Move E2E related ESLint configuration into custom config.
|
|
|
|
//
|
|
|
|
// We should have linting properties only included for files that they
|
|
|
|
// are specific to as opposed to globally.
|
|
|
|
page: 'readonly',
|
|
|
|
browser: 'readonly',
|
|
|
|
context: 'readonly',
|
|
|
|
jestPuppeteer: 'readonly',
|
2018-11-13 19:21:04 +00:00
|
|
|
},
|
2020-09-20 23:54:08 +00:00
|
|
|
settings: {
|
|
|
|
jsdoc: { mode: 'typescript' },
|
2021-01-28 13:53:09 +00:00
|
|
|
// List of modules that are externals in our webpack config.
|
|
|
|
// This helps the `import/no-extraneous-dependencies` and
|
|
|
|
//`import/no-unresolved` rules account for them.
|
|
|
|
'import/core-modules': [
|
|
|
|
'@woocommerce/block-data',
|
|
|
|
'@woocommerce/blocks-checkout',
|
2021-02-04 15:30:28 +00:00
|
|
|
'@woocommerce/price-format',
|
2021-01-28 13:53:09 +00:00
|
|
|
'@woocommerce/settings',
|
|
|
|
'@woocommerce/shared-context',
|
|
|
|
'@woocommerce/shared-hocs',
|
|
|
|
'@wordpress/a11y',
|
|
|
|
'@wordpress/api-fetch',
|
|
|
|
'@wordpress/block-editor',
|
|
|
|
'@wordpress/compose',
|
|
|
|
'@wordpress/data',
|
|
|
|
'@wordpress/escape-html',
|
|
|
|
'@wordpress/hooks',
|
|
|
|
'@wordpress/keycodes',
|
|
|
|
'@wordpress/url',
|
2022-05-23 12:05:30 +00:00
|
|
|
'@woocommerce/blocks-test-utils',
|
|
|
|
'@woocommerce/e2e-utils',
|
2021-01-28 13:53:09 +00:00
|
|
|
'babel-jest',
|
|
|
|
'dotenv',
|
|
|
|
'jest-environment-puppeteer',
|
|
|
|
'lodash/kebabCase',
|
|
|
|
'lodash',
|
|
|
|
'prop-types',
|
|
|
|
'react',
|
|
|
|
'requireindex',
|
|
|
|
],
|
|
|
|
'import/resolver': {
|
|
|
|
node: {},
|
|
|
|
webpack: {},
|
2021-02-24 01:36:24 +00:00
|
|
|
typescript: {},
|
2021-01-28 13:53:09 +00:00
|
|
|
},
|
2020-09-20 23:54:08 +00:00
|
|
|
},
|
2018-11-13 19:21:04 +00:00
|
|
|
rules: {
|
2020-06-05 19:13:51 +00:00
|
|
|
'woocommerce/feature-flag': 'off',
|
2020-10-28 09:14:46 +00:00
|
|
|
'react-hooks/exhaustive-deps': 'error',
|
2020-12-14 11:54:34 +00:00
|
|
|
'react/jsx-fragments': [ 'error', 'syntax' ],
|
2021-01-11 12:12:26 +00:00
|
|
|
'@wordpress/no-global-active-element': 'warn',
|
2021-11-08 09:06:29 +00:00
|
|
|
'@wordpress/i18n-text-domain': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
allowedTextDomain: [ 'woo-gutenberg-products-block' ],
|
|
|
|
},
|
|
|
|
],
|
2021-07-09 16:53:45 +00:00
|
|
|
camelcase: [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
properties: 'never',
|
|
|
|
ignoreGlobals: true,
|
|
|
|
},
|
|
|
|
],
|
2019-09-05 15:09:31 +00:00
|
|
|
},
|
2021-01-05 13:58:18 +00:00
|
|
|
overrides: [
|
|
|
|
{
|
|
|
|
files: [ '**/bin/**.js', '**/storybook/**.js', '**/stories/**.js' ],
|
|
|
|
rules: {
|
|
|
|
'you-dont-need-lodash-underscore/omit': 'off',
|
|
|
|
},
|
|
|
|
},
|
2021-02-24 01:36:24 +00:00
|
|
|
{
|
|
|
|
files: [ '*.ts', '*.tsx' ],
|
|
|
|
parser: '@typescript-eslint/parser',
|
|
|
|
extends: [
|
|
|
|
'plugin:@woocommerce/eslint-plugin/recommended',
|
|
|
|
'plugin:you-dont-need-lodash-underscore/compatible',
|
|
|
|
'plugin:@typescript-eslint/recommended',
|
|
|
|
],
|
|
|
|
rules: {
|
|
|
|
'@typescript-eslint/no-explicit-any': 'error',
|
|
|
|
'no-use-before-define': 'off',
|
|
|
|
'@typescript-eslint/no-use-before-define': [ 'error' ],
|
|
|
|
'jsdoc/require-param': 'off',
|
2021-03-09 10:50:51 +00:00
|
|
|
'no-shadow': 'off',
|
|
|
|
'@typescript-eslint/no-shadow': [ 'error' ],
|
2021-05-16 17:59:32 +00:00
|
|
|
'@typescript-eslint/no-unused-vars': [
|
|
|
|
'error',
|
|
|
|
{ ignoreRestSiblings: true },
|
|
|
|
],
|
2021-07-09 16:53:45 +00:00
|
|
|
camelcase: 'off',
|
|
|
|
'@typescript-eslint/naming-convention': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
selector: [ 'method', 'variableLike' ],
|
|
|
|
format: [ 'camelCase', 'PascalCase', 'UPPER_CASE' ],
|
|
|
|
leadingUnderscore: 'allowSingleOrDouble',
|
|
|
|
filter: {
|
|
|
|
regex: 'webpack_public_path__',
|
|
|
|
match: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
selector: 'typeProperty',
|
|
|
|
format: [ 'camelCase', 'snake_case' ],
|
|
|
|
filter: {
|
|
|
|
regex: 'API_FETCH_WITH_HEADERS|Block',
|
|
|
|
match: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2021-02-24 01:36:24 +00:00
|
|
|
},
|
|
|
|
},
|
2021-03-10 15:03:26 +00:00
|
|
|
{
|
|
|
|
files: [ './assets/js/mapped-types.ts' ],
|
|
|
|
rules: {
|
|
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
|
|
'@typescript-eslint/no-shadow': 'off',
|
|
|
|
'no-shadow': 'off',
|
|
|
|
},
|
|
|
|
},
|
2021-01-05 13:58:18 +00:00
|
|
|
],
|
2018-11-13 19:21:04 +00:00
|
|
|
};
|