chore: simplify eslint configuration (#44347)

* chore: extend import/recommended

* chore: use recommended lint rules

* refactor: apply lint rules

* chore: drop used config
This commit is contained in:
Oliver Eyton-Williams
2021-12-02 01:01:12 +01:00
committed by GitHub
parent 4a4aa1f2f9
commit efba2e777d
16 changed files with 46 additions and 217 deletions

View File

@@ -202,7 +202,8 @@ const motivationSchemaValidation = languages => {
if (
!fileJson.motivationalQuotes.every(
object =>
object.hasOwnProperty('quote') && object.hasOwnProperty('author')
Object.prototype.hasOwnProperty.call(object, 'quote') &&
Object.prototype.hasOwnProperty.call(object, 'author')
)
) {
console.warn(`${language}/motivation.json has malformed quote objects.`);

View File

@@ -31,7 +31,6 @@ function createChallengeNode(challenge, reporter) {
type: challenge.challengeType === 7 ? 'CertificateNode' : 'ChallengeNode'
};
/* eslint-disable prefer-object-spread/prefer-object-spread */
return JSON.parse(
JSON.stringify(
Object.assign(

View File

@@ -29,7 +29,7 @@ exports.sourceNodes = function sourceChallengesSourceNodes(
}
const { createNode } = actions;
const watcher = chokidar.watch(curriculumPath, {
ignored: /(^|[\/\\])\../,
ignored: /(^|[/\\])\../,
ignoreInitial: true,
persistent: true,
usePolling: true,

View File

@@ -62,7 +62,7 @@ async function initTestFrame(e: InitTestFrameArg = { code: {} }) {
Object.freeze(o);
Object.getOwnPropertyNames(o).forEach(function (prop) {
if (
o.hasOwnProperty(prop) &&
Object.prototype.hasOwnProperty.call(o, prop) &&
o[prop] !== null &&
(typeof o[prop] === 'object' || typeof o[prop] === 'function') &&
!Object.isFrozen(o[prop])

View File

@@ -2,10 +2,7 @@ import React from 'react';
import styles from './skeleton-styles';
// TODO: unsure about parameter typing
function SkeletonSprite({}: React.FC<
React.ComponentPropsWithoutRef<'svg'>
>): JSX.Element {
function SkeletonSprite(): JSX.Element {
return (
<div className='sprite-container'>
<style dangerouslySetInnerHTML={{ __html: styles }} />

View File

@@ -109,7 +109,7 @@ function InstantSearchRoot({
if (
location.state &&
typeof location.state === 'object' &&
location.state.hasOwnProperty('query')
Object.prototype.hasOwnProperty.call(location.state, 'query')
) {
updateSearchQuery(location.state.query);
} else if (location.search) {

View File

@@ -92,7 +92,7 @@ const buildFunctions = {
export function canBuildChallenge(challengeData) {
const { challengeType } = challengeData;
return buildFunctions.hasOwnProperty(challengeType);
return Object.prototype.hasOwnProperty.call(buildFunctions, challengeType);
}
export async function buildChallenge(challengeData, options) {

View File

@@ -122,7 +122,10 @@ const SuperBlockIntroductionPage = (props: SuperBlockProp) => {
if (
location.state &&
typeof location.state === 'object' &&
location.state.hasOwnProperty('breadcrumbBlockClick')
Object.prototype.hasOwnProperty.call(
location.state,
'breadcrumbBlockClick'
)
) {
return location.state.breadcrumbBlockClick;
}