Skip to content

Commit

Permalink
Merge pull request #1665: Update eslint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlin authored May 4, 2023
2 parents a927867 + 09b5f3f commit 1190f88
Show file tree
Hide file tree
Showing 58 changed files with 1,155 additions and 1,654 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist/*
docs/*
node_modules/*
dev-server.js
webpack.config.js
106 changes: 0 additions & 106 deletions .eslintrc

This file was deleted.

48 changes: 48 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
extends:
- eslint:recommended
- plugin:react/recommended
- plugin:react-hooks/recommended

plugins:
- react
- react-hooks

parser: "@babel/eslint-parser"

globals:
page: true
browser: true
context: true
jestPuppeteer: true
BASE_URL: true

rules:
# Code quality rules
no-unused-vars: ["error", { "argsIgnorePattern": "^_", "destructuredArrayIgnorePattern": "^_" }]
no-use-before-define: ["error", { "functions": false }]
prefer-const: ["error", {"destructuring": "all"}]
react/no-array-index-key: error
react/prop-types: off # Remove this override once all props have been typed using PropTypes or TypeScript.

# Code style rules
arrow-parens: ["error", "always"]
no-unneeded-ternary: ["error", { "defaultAssignment": true }]
operator-linebreak: ["error", "after", { "overrides": { "?": "ignore", ":": "ignore" } }]
quote-props: ["error", "as-needed"]

parserOptions:
ecmaVersion: 6
sourceType: module
ecmaFeatures:
modules: true

env:
es6: true
browser: true
node: true
jest: true

settings:
react:
version: detect
2 changes: 1 addition & 1 deletion cli/server/convertJsonSchemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const setAuthorInfoOnTree = (v2, meta) => {
* The feature information was an object with properties `start`, `end` and `strand`
*/
const convertToGffFormat = (annotations) => {
for (const name in annotations) { // eslint-disable-line
for (const name in annotations) {
// Convert from 0-based BED format to 1-based GFF format for start position
annotations[name].start += 1;
// half-open 0-based BED end position is the same as 1-based closed ended GFF position.
Expand Down
2 changes: 1 addition & 1 deletion cli/server/getDataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const getAvailable = require("./getAvailable");
const helpers = require("./getDatasetHelpers");

const setUpGetDatasetHandler = ({datasetsPath}) => {
return async (req, res) => { // eslint-disable-line consistent-return
return async (req, res) => {
try {
const availableDatasets = await getAvailable.getAvailableDatasets(datasetsPath);
const info = helpers.interpretRequest(req, datasetsPath);
Expand Down
1 change: 0 additions & 1 deletion cli/server/getNarrative.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const queryString = require("query-string");
const path = require("path");
const fs = require("fs");
const utils = require("../utils");
const marked = require('marked');

const setUpGetNarrativeHandler = ({narrativesPath}) => {
return async (req, res) => {
Expand Down
1 change: 0 additions & 1 deletion cli/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
const fs = require('fs');
const chalk = require('chalk');
const path = require("path");
const fetch = require('node-fetch');

const verbose = (msg) => {
if (global.AUSPICE_VERBOSE) {
Expand Down
2 changes: 1 addition & 1 deletion cli/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const loadAndAddHandlers = ({app, handlersArg, datasetDir, narrativeDir}) => {
if (handlersArg) {
const handlersPath = path.resolve(handlersArg);
utils.verbose(`Loading handlers from ${handlersPath}`);
const inject = require(handlersPath); // eslint-disable-line
const inject = require(handlersPath);
handlers.getAvailable = inject.getAvailable;
handlers.getDataset = inject.getDataset;
handlers.getNarrative = inject.getNarrative;
Expand Down
Loading

0 comments on commit 1190f88

Please sign in to comment.