houdini/.eslintrc.js

83 lines
1.6 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'];
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",
2020-06-26 23:18:41 +00:00
"always"
2020-06-27 00:47:37 +00:00
],
"no-trailing-spaces": ["error"],
"indent": ["error", "tab"], // we use tabs for accessibility
},
"settings": {
"react": {
"version": "detect"
},
}
};