Simplified eslint config

This commit is contained in:
Alejandro Celaya 2020-09-06 09:32:16 +02:00
parent f33d1fca39
commit dcdee8b308
8 changed files with 26 additions and 70 deletions

View file

@ -1,4 +1,7 @@
{
"extends": [
"@shlinkio/js-coding-standard"
],
"plugins": ["jest"],
"env": {
"jest/globals": true
@ -11,67 +14,15 @@
"process": true,
"setImmediate": true
},
"overrides": [
{
"files": ["**/*.js"],
"extends": [
"adidas-env/browser",
"adidas-env/module",
"adidas-env/node",
"adidas-es9",
"adidas-babel",
"adidas-react"
],
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
"max-len": ["error", {
"code": 120,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreComments": true
}],
"no-mixed-operators": "off",
"comma-dangle": ["error", "always-multiline"],
"no-invalid-this": "off",
"no-inline-comments": "off",
"no-console": "warn",
"template-curly-spacing": ["error", "never"],
"no-warning-comments": "off",
"no-undefined": "off",
"indent": ["error", 2, {"SwitchCase": 1}],
"no-empty-function": "off",
"lines-around-comment": "off",
"no-magic-numbers": "off",
"react/no-array-index-key": "off",
"react/no-did-update-set-state": "off",
"react/display-name": "off",
"react/jsx-curly-spacing": ["error", "never"],
"react/jsx-indent-props": ["error", 2],
"react/jsx-first-prop-new-line": ["error", "multiline-multiprop"],
"react/jsx-closing-bracket-location": ["error", "tag-aligned"],
"react/jsx-filename-extension": ["error", {"extensions": [".js", ".jsx"]}]
}
},
{
"files": ["**/*.ts", "**/*.tsx"],
"extends": [
"@shlinkio/js-coding-standard"
],
"rules": {
"max-len": ["error", {
"code": 120,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreComments": true
}],
"no-mixed-operators": "off",
"react/display-name": "off",
"@typescript-eslint/require-array-sort-compare": "off"
}
}
]
"rules": {
"max-len": ["error", {
"code": 120,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreComments": true
}],
"no-mixed-operators": "off",
"react/display-name": "off",
"@typescript-eslint/require-array-sort-compare": "off"
}
}

View file

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing, @typescript-eslint/promise-function-async, @typescript-eslint/prefer-optional-chain */
const fs = require('fs');
const path = require('path');

View file

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing, @typescript-eslint/promise-function-async, @typescript-eslint/prefer-optional-chain */
const path = require('path');
const fs = require('fs');

View file

@ -227,7 +227,7 @@ module.exports = (webpackEnv) => {
// Turned on because emoji and regex is not minified properly using default
// https://github.com/facebook/create-react-app/issues/2488
ascii_only: true,
ascii_only: true, // eslint-disable-line @typescript-eslint/camelcase
},
},
@ -668,7 +668,7 @@ module.exports = (webpackEnv) => {
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty',
child_process: 'empty', // eslint-disable-line @typescript-eslint/camelcase
},
// Turn off performance processing because we utilize

View file

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
const fs = require('fs');
const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware');

View file

@ -1,4 +1,4 @@
/* eslint-disable no-console */
/* eslint-disable no-console, @typescript-eslint/prefer-nullish-coalescing, @typescript-eslint/promise-function-async, @typescript-eslint/prefer-optional-chain */
// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'production';
@ -43,8 +43,8 @@ if (!checkRequiredFiles([ paths.appHtml, paths.appIndexJs ])) {
// Process CLI arguments
const argvSliceStart = 2;
const argv = process.argv.slice(argvSliceStart);
const writeStatsJson = argv.indexOf('--stats') !== -1;
const withoutDist = argv.indexOf('--no-dist') !== -1;
const writeStatsJson = argv.includes('--stats');
const withoutDist = argv.includes('--no-dist');
const { version, hasVersion } = getVersionFromArgs(argv);
// Generate configuration

View file

@ -1,4 +1,4 @@
/* eslint-disable no-console */
/* eslint-disable no-console, @typescript-eslint/prefer-nullish-coalescing, @typescript-eslint/promise-function-async, @typescript-eslint/prefer-optional-chain */
// Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'development';

View file

@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/promise-function-async, @typescript-eslint/no-misused-promises */
// In production, we register a service worker to serve assets from local cache.
// This lets the app load faster on subsequent visits in production, and gives
@ -96,7 +98,7 @@ function checkValidServiceWorker(swUrl) {
// Ensure service worker exists, and that we really are getting a JS file.
if (
response.status === NOT_FOUND_STATUS ||
response.headers.get('content-type').indexOf('javascript') === -1
response.headers.get('content-type').includes('javascript')
) {
// No service worker found. Probably a different app. Reload the page.
return navigator.serviceWorker.ready.then((registration) =>