2021-05-30 18:49:33 +02:00
|
|
|
const fs = require('fs');
|
|
|
|
|
2019-12-16 12:17:37 -05:00
|
|
|
module.exports = {
|
|
|
|
parser: 'babel-eslint',
|
|
|
|
extends: [
|
|
|
|
'eslint:recommended',
|
|
|
|
'plugin:react/recommended',
|
|
|
|
'plugin:cypress/recommended',
|
|
|
|
'prettier',
|
2021-05-30 18:49:33 +02:00
|
|
|
'plugin:import/recommended',
|
2019-12-16 12:17:37 -05:00
|
|
|
],
|
|
|
|
env: {
|
|
|
|
es6: true,
|
|
|
|
browser: true,
|
|
|
|
node: true,
|
|
|
|
jest: true,
|
|
|
|
'cypress/globals': true,
|
|
|
|
},
|
|
|
|
globals: {
|
2022-09-30 06:13:47 -06:00
|
|
|
SIMPLE_CMS_CORE_VERSION: false,
|
2019-12-16 12:17:37 -05:00
|
|
|
CMS_ENV: false,
|
|
|
|
},
|
|
|
|
rules: {
|
|
|
|
'no-console': [0],
|
|
|
|
'react/prop-types': [0],
|
2021-05-30 18:49:33 +02:00
|
|
|
'import/no-named-as-default': 0,
|
2021-05-31 16:46:41 +02:00
|
|
|
'import/order': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
'newlines-between': 'always',
|
|
|
|
groups: [['builtin', 'external'], ['internal', 'parent', 'sibling', 'index'], ['type']],
|
|
|
|
},
|
|
|
|
],
|
2019-12-16 12:17:37 -05:00
|
|
|
'no-duplicate-imports': 'error',
|
2022-09-28 20:04:00 -06:00
|
|
|
'@emotion/no-vanilla': 'off',
|
2020-11-18 18:59:30 +02:00
|
|
|
'@emotion/import-from-emotion': 'error',
|
|
|
|
'@emotion/styled-import': 'error',
|
2019-12-18 18:16:02 +02:00
|
|
|
'require-atomic-updates': [0],
|
|
|
|
'object-shorthand': ['error', 'always'],
|
2020-02-13 02:12:36 +02:00
|
|
|
'prefer-const': [
|
|
|
|
'error',
|
|
|
|
{
|
|
|
|
destructuring: 'all',
|
|
|
|
},
|
|
|
|
],
|
2022-03-28 19:29:56 +02:00
|
|
|
'unicorn/prefer-string-slice': 'error',
|
2022-09-28 20:04:00 -06:00
|
|
|
'react/no-unknown-property': ['error', { ignore: ['css'] }],
|
2019-12-16 12:17:37 -05:00
|
|
|
},
|
2022-03-28 19:29:56 +02:00
|
|
|
plugins: ['babel', '@emotion', 'cypress', 'unicorn'],
|
2019-12-16 12:17:37 -05:00
|
|
|
settings: {
|
|
|
|
react: {
|
|
|
|
version: 'detect',
|
|
|
|
},
|
2021-05-30 18:49:33 +02:00
|
|
|
'import/resolver': {
|
|
|
|
node: {
|
|
|
|
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
|
|
},
|
|
|
|
},
|
2022-09-30 06:13:47 -06:00
|
|
|
'import/core-modules': ['src'],
|
2019-12-16 12:17:37 -05:00
|
|
|
},
|
2019-12-18 18:16:02 +02:00
|
|
|
overrides: [
|
|
|
|
{
|
|
|
|
files: ['*.ts', '*.tsx'],
|
|
|
|
parser: '@typescript-eslint/parser',
|
|
|
|
extends: [
|
|
|
|
'eslint:recommended',
|
|
|
|
'plugin:react/recommended',
|
|
|
|
'plugin:cypress/recommended',
|
|
|
|
'plugin:@typescript-eslint/recommended',
|
2021-03-01 11:16:19 +02:00
|
|
|
'prettier',
|
2021-05-30 18:49:33 +02:00
|
|
|
'plugin:import/recommended',
|
2019-12-18 18:16:02 +02:00
|
|
|
'plugin:import/typescript',
|
|
|
|
],
|
|
|
|
parserOptions: {
|
|
|
|
ecmaVersion: 2018,
|
|
|
|
sourceType: 'module',
|
|
|
|
ecmaFeatures: {
|
|
|
|
jsx: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
rules: {
|
2021-05-31 14:23:16 +02:00
|
|
|
'no-duplicate-imports': [0], // handled by @typescript-eslint
|
|
|
|
'@typescript-eslint/ban-types': [0], // TODO enable in future
|
2020-01-15 00:15:14 +02:00
|
|
|
'@typescript-eslint/no-non-null-assertion': [0],
|
2021-05-31 14:23:16 +02:00
|
|
|
'@typescript-eslint/consistent-type-imports': 'error',
|
2021-02-14 18:41:02 +01:00
|
|
|
'@typescript-eslint/explicit-function-return-type': [0],
|
2021-05-31 14:23:16 +02:00
|
|
|
'@typescript-eslint/explicit-module-boundary-types': [0],
|
|
|
|
'@typescript-eslint/no-duplicate-imports': 'error',
|
2019-12-18 18:16:02 +02:00
|
|
|
'@typescript-eslint/no-use-before-define': [
|
|
|
|
'error',
|
|
|
|
{ functions: false, classes: true, variables: true },
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2021-05-30 18:49:33 +02:00
|
|
|
{
|
|
|
|
files: ['website/**/*'],
|
|
|
|
rules: {
|
|
|
|
'import/no-unresolved': [0],
|
|
|
|
},
|
|
|
|
},
|
2019-12-18 18:16:02 +02:00
|
|
|
],
|
2019-12-16 12:17:37 -05:00
|
|
|
};
|