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"], "plugins": ["jest"],
"env": { "env": {
"jest/globals": true "jest/globals": true
@ -11,67 +14,15 @@
"process": true, "process": true,
"setImmediate": true "setImmediate": true
}, },
"overrides": [ "rules": {
{ "max-len": ["error", {
"files": ["**/*.js"], "code": 120,
"extends": [ "ignoreStrings": true,
"adidas-env/browser", "ignoreTemplateLiterals": true,
"adidas-env/module", "ignoreComments": true
"adidas-env/node", }],
"adidas-es9", "no-mixed-operators": "off",
"adidas-babel", "react/display-name": "off",
"adidas-react" "@typescript-eslint/require-array-sort-compare": "off"
], }
"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"
}
}
]
} }

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 fs = require('fs');
const path = require('path'); 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 path = require('path');
const fs = require('fs'); 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 // Turned on because emoji and regex is not minified properly using default
// https://github.com/facebook/create-react-app/issues/2488 // 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', fs: 'empty',
net: 'empty', net: 'empty',
tls: 'empty', tls: 'empty',
child_process: 'empty', child_process: 'empty', // eslint-disable-line @typescript-eslint/camelcase
}, },
// Turn off performance processing because we utilize // 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 fs = require('fs');
const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware'); 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. // Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'production'; process.env.BABEL_ENV = 'production';
@ -43,8 +43,8 @@ if (!checkRequiredFiles([ paths.appHtml, paths.appIndexJs ])) {
// Process CLI arguments // Process CLI arguments
const argvSliceStart = 2; const argvSliceStart = 2;
const argv = process.argv.slice(argvSliceStart); const argv = process.argv.slice(argvSliceStart);
const writeStatsJson = argv.indexOf('--stats') !== -1; const writeStatsJson = argv.includes('--stats');
const withoutDist = argv.indexOf('--no-dist') !== -1; const withoutDist = argv.includes('--no-dist');
const { version, hasVersion } = getVersionFromArgs(argv); const { version, hasVersion } = getVersionFromArgs(argv);
// Generate configuration // 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. // Do this as the first thing so that any code reading it knows the right env.
process.env.BABEL_ENV = 'development'; 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. // 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 // 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. // Ensure service worker exists, and that we really are getting a JS file.
if ( if (
response.status === NOT_FOUND_STATUS || 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. // No service worker found. Probably a different app. Reload the page.
return navigator.serviceWorker.ready.then((registration) => return navigator.serviceWorker.ready.then((registration) =>