houdini/.eslintrc.js

85 lines
1.8 KiB
JavaScript
Raw Normal View History

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
const _ = require('lodash');
const tsSpecBase = {
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
'jest',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:jest/all',
],
rules: {
"jest/lowercase-name": ["error", { "ignore": ["describe"] }],
},
};
const tsSpec = _.cloneDeep(tsSpecBase);
tsSpec['files'] = ['**/*.spec.ts'];
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",
],
};
const tsSettings = _.cloneDeep(tsBase);
tsSettings['files'] = ['**/*.ts'];
const tsxSettings = _.cloneDeep(tsBase);
tsxSettings['files'] = ['**/*.tsx'];
2020-06-30 19:40:08 +00:00
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',
],
2020-06-27 00:47:37 +00:00
},
tsSpec,
tsxSpec,
tsSettings,
tsxSettings,
],
"rules": {
"linebreak-style": [
"error",
"unix",
],
"semi": [
"error",
"always",
2020-06-27 00:47:37 +00:00
],
"no-trailing-spaces": ["error"],
2020-06-30 19:40:08 +00:00
"indent": ["error", "tab", {"SwitchCase": 1}], // we use tabs for accessibility
"comma-dangle": ["error", "always-multiline"],
},
"settings": {
"react": {
"version": "detect",
},
},
};