2020-06-12 20:03:43 +00:00
|
|
|
// License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
|
|
|
|
// Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE
|
2020-06-29 20:54:35 +00:00
|
|
|
const _ = require('lodash');
|
|
|
|
|
|
|
|
const tsSpecBase = {
|
|
|
|
parser: '@typescript-eslint/parser',
|
|
|
|
plugins: [
|
|
|
|
'@typescript-eslint',
|
2020-09-30 17:05:22 +00:00
|
|
|
'jest',
|
2020-06-29 20:54:35 +00:00
|
|
|
],
|
|
|
|
extends: [
|
|
|
|
'eslint:recommended',
|
|
|
|
'plugin:@typescript-eslint/recommended',
|
2020-09-30 17:05:22 +00:00
|
|
|
'plugin:jest/all',
|
2020-11-06 21:58:14 +00:00
|
|
|
'plugin:react-hooks/recommended',
|
2020-06-29 20:54:35 +00:00
|
|
|
],
|
2020-06-29 21:01:52 +00:00
|
|
|
rules: {
|
2020-09-30 17:05:22 +00:00
|
|
|
"jest/lowercase-name": ["error", { "ignore": ["describe"] }],
|
2020-11-12 23:04:08 +00:00
|
|
|
"react-hooks/exhaustive-deps": 'error',
|
2020-09-30 17:05:22 +00:00
|
|
|
},
|
2020-06-29 20:54:35 +00:00
|
|
|
};
|
|
|
|
|
2020-06-29 21:01:52 +00:00
|
|
|
|
2020-06-29 20:54:35 +00:00
|
|
|
const tsSpec = _.cloneDeep(tsSpecBase);
|
|
|
|
tsSpec['files'] = ['**/*.spec.ts'];
|
2020-06-26 21:50:19 +00:00
|
|
|
|
2020-06-29 21:01:52 +00:00
|
|
|
const tsxSpec = _.cloneDeep(tsSpecBase);
|
|
|
|
tsxSpec['files'] = ['**/*.spec.tsx'];
|
|
|
|
tsxSpec['plugins'] = [...tsxSpec['plugins'], "react"];
|
|
|
|
tsxSpec['extends'] = [...tsxSpec['extends'], "plugin:react/recommended"];
|
|
|
|
|
|
|
|
|
|
|
|
const tsBase = {
|
|
|
|
parser: '@typescript-eslint/parser',
|
|
|
|
plugins: [
|
|
|
|
'@typescript-eslint',
|
|
|
|
],
|
|
|
|
extends: [
|
|
|
|
'eslint:recommended',
|
|
|
|
'plugin:@typescript-eslint/recommended',
|
|
|
|
"plugin:react-hooks/recommended",
|
2020-09-30 17:05:22 +00:00
|
|
|
],
|
2020-10-22 19:35:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const tsSettings = _.cloneDeep(tsBase);
|
|
|
|
tsSettings['files'] = ['**/*.ts'];
|
|
|
|
|
|
|
|
const tsxSettings = _.cloneDeep(tsBase);
|
|
|
|
tsxSettings['files'] = ['**/*.tsx'];
|
|
|
|
tsxSettings['plugins'] = [...tsxSpec['plugins'], "react"];
|
|
|
|
tsxSettings['extends'] = [...tsxSpec['extends'], "plugin:react/recommended"];
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
root: true,
|
|
|
|
overrides: [
|
|
|
|
{
|
|
|
|
"files": ['*.js', 'config/webpack/**/*.js'],
|
|
|
|
extends: [
|
|
|
|
'eslint:recommended',
|
|
|
|
'plugin:node/recommended',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
tsSpec,
|
|
|
|
tsxSpec,
|
|
|
|
tsSettings,
|
|
|
|
tsxSettings,
|
|
|
|
{
|
|
|
|
"files": ['*.stories.ts', '*.stories.tsx'],
|
|
|
|
"rules": {
|
|
|
|
"@typescript-eslint/explicit-module-boundary-types": ["off"],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
"rules": {
|
|
|
|
"linebreak-style": [
|
|
|
|
"error",
|
|
|
|
"unix",
|
|
|
|
],
|
|
|
|
"semi": [
|
|
|
|
"error",
|
|
|
|
"always",
|
|
|
|
],
|
|
|
|
"no-trailing-spaces": ["error"],
|
|
|
|
"indent": ["error", "tab", { "SwitchCase": 1 }], // we use tabs for accessibility
|
|
|
|
"comma-dangle": "off",
|
|
|
|
"@typescript-eslint/comma-dangle": ["error", "always-multiline"],
|
|
|
|
"@typescript-eslint/no-unused-vars": ['error', { "args": "all", "argsIgnorePattern": "^_" }],
|
2020-10-22 19:24:14 +00:00
|
|
|
'@typescript-eslint/member-ordering': ['error',
|
|
|
|
{
|
|
|
|
// this is the default from @typescript-eslint itself
|
|
|
|
"default": {
|
|
|
|
"memberTypes": [
|
|
|
|
// Index signature
|
|
|
|
"signature",
|
|
|
|
|
|
|
|
// Fields
|
|
|
|
"public-static-field",
|
|
|
|
"protected-static-field",
|
|
|
|
"private-static-field",
|
|
|
|
|
|
|
|
"public-decorated-field",
|
|
|
|
"protected-decorated-field",
|
|
|
|
"private-decorated-field",
|
|
|
|
|
|
|
|
"public-instance-field",
|
|
|
|
"protected-instance-field",
|
|
|
|
"private-instance-field",
|
|
|
|
|
|
|
|
"public-abstract-field",
|
|
|
|
"protected-abstract-field",
|
|
|
|
"private-abstract-field",
|
|
|
|
|
|
|
|
"public-field",
|
|
|
|
"protected-field",
|
|
|
|
"private-field",
|
|
|
|
|
|
|
|
"static-field",
|
|
|
|
"instance-field",
|
|
|
|
"abstract-field",
|
|
|
|
|
|
|
|
"decorated-field",
|
|
|
|
|
|
|
|
"field",
|
|
|
|
|
|
|
|
// Constructors
|
|
|
|
"public-constructor",
|
|
|
|
"protected-constructor",
|
|
|
|
"private-constructor",
|
|
|
|
|
|
|
|
"constructor",
|
|
|
|
|
|
|
|
// Methods
|
|
|
|
"public-static-method",
|
|
|
|
"protected-static-method",
|
|
|
|
"private-static-method",
|
|
|
|
|
|
|
|
"public-decorated-method",
|
|
|
|
"protected-decorated-method",
|
|
|
|
"private-decorated-method",
|
|
|
|
|
|
|
|
"public-instance-method",
|
|
|
|
"protected-instance-method",
|
|
|
|
"private-instance-method",
|
|
|
|
|
|
|
|
"public-abstract-method",
|
|
|
|
"protected-abstract-method",
|
|
|
|
"private-abstract-method",
|
|
|
|
|
|
|
|
"public-method",
|
|
|
|
"protected-method",
|
|
|
|
"private-method",
|
|
|
|
|
|
|
|
"static-method",
|
|
|
|
"instance-method",
|
|
|
|
"abstract-method",
|
|
|
|
|
|
|
|
"decorated-method",
|
|
|
|
|
|
|
|
"method",
|
|
|
|
],
|
|
|
|
"order": "alphabetically",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2020-10-22 19:27:07 +00:00
|
|
|
'@typescript-eslint/member-delimiter-style': ['error',
|
|
|
|
{
|
|
|
|
"multiline": {
|
|
|
|
"delimiter": "semi",
|
|
|
|
"requireLast": true,
|
|
|
|
},
|
|
|
|
"singleline": {
|
|
|
|
"delimiter": "comma",
|
|
|
|
"requireLast": false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2020-11-12 23:30:22 +00:00
|
|
|
"react-hooks/exhaustive-deps": 'error',
|
2020-10-22 19:24:14 +00:00
|
|
|
},
|
2020-06-29 21:01:52 +00:00
|
|
|
"settings": {
|
|
|
|
"react": {
|
2020-09-30 17:05:22 +00:00
|
|
|
"version": "detect",
|
2020-06-29 21:01:52 +00:00
|
|
|
},
|
2020-09-30 17:05:22 +00:00
|
|
|
},
|
2018-03-25 17:30:42 +00:00
|
|
|
};
|