docbrown/app/javascript/.eslintrc.js
Suzanne Aitchison ad43dbe0b3
Add prefer object destructuring lint rule (#13183)
* add prefer object destructuring lint rule

* fix typo

* sweep up lint errors missed in config controller

* Revert "fix typo"

This reverts commit 44f9d57e3f0dc4007ab9020c8c659c2f770230c2.

* Revert "sweep up lint errors missed in config controller"

This reverts commit 3f8d5d782fe110607c2172b713c74c08c883eda3.

* make this a warning rather than error for now

* undo auto change
2021-05-04 12:10:32 +01:00

79 lines
1.7 KiB
JavaScript

const path = require('path');
module.exports = {
parser: 'babel-eslint',
extends: [
'eslint:recommended',
'plugin:import/errors',
'plugin:import/warnings',
'preact',
'plugin:jsx-a11y/recommended',
'prettier',
],
parserOptions: {
ecmaVersion: 2018,
ecmaFeatures: {
jsx: true,
},
},
settings: {
react: {
pragma: 'h',
},
'import/resolver': {
webpack: {
config: {
resolve: {
alias: {
'@crayons': path.join(__dirname, './crayons'),
'@utilities': path.join(__dirname, './utilities'),
'@components': path.join(__dirname, './shared/components'),
},
extensions: ['.js', '.jsx'],
},
},
},
},
},
env: {
jest: true,
browser: true,
},
plugins: ['import', 'react', 'jsx-a11y'],
rules: {
'import/order': ['error'],
'import/prefer-default-export': 'off',
'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'jsx-a11y/label-has-associated-control': [
'error',
{
required: {
some: ['nesting', 'id'],
},
},
],
'react/jsx-no-target-blank': [2, { enforceDynamicLinks: 'always' }],
'jsx-a11y/no-onchange': 'off',
'prefer-const': ['error'],
'prefer-destructuring': ['warn', { object: true, array: false }],
},
overrides: [
{
// Turn this rule off for barrel files
files: ['**/index.js'],
rules: {
'import/export': 'off',
},
},
],
globals: {
getCsrfToken: false,
sendFetch: false,
InstantClick: false,
filterXSS: false,
Pusher: false,
ga: false,
Honeybadger: false,
AndroidBridge: false,
},
};