Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update eslint rules #1665

Merged
merged 30 commits into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b5d2ec0
Remove non-existent file from .eslintignore
victorlin Apr 25, 2023
7878ac4
Clarify existing scope of ESLint
victorlin Apr 25, 2023
d5217e7
eslint: Remove stale comment
victorlin Apr 13, 2023
cbb40e5
eslint: Add extension to config file
victorlin Apr 22, 2023
b3cedb7
eslint: Replace Airbnb base config
victorlin Apr 21, 2023
7c42bc8
Run ESLint on cli/, scripts/, test/
victorlin Apr 25, 2023
103e527
Upgrade to ESLint 8
victorlin Apr 22, 2023
3964bf9
Add whitespace for readability
victorlin Apr 22, 2023
1e22f41
eslint: Address no-case-declarations violations
victorlin Apr 21, 2023
94bea96
eslint: Address no-compare-neg-zero violations
victorlin Apr 22, 2023
0b84281
eslint: Address no-cond-assign violations
victorlin Apr 22, 2023
b0809d3
eslint: Address no-prototype-builtins violations
victorlin Apr 22, 2023
f8bca60
eslint: Partially address no-unused-vars violations
victorlin Apr 25, 2023
98ae4d9
Remove unused node-fetch import
victorlin Apr 25, 2023
57769cf
Remove unused marked import
victorlin Apr 25, 2023
c9cea8d
Remove unused function isValidJSONCallback
victorlin Apr 25, 2023
53dc6aa
eslint: Address react/no-deprecated violations
victorlin Apr 22, 2023
7c7cdce
eslint: Address react/no-direct-mutation-state violations
victorlin Apr 22, 2023
f80a98e
Remove unused currentBounds state
victorlin Apr 25, 2023
9d5db44
Add a note for react/prop-types
victorlin Apr 22, 2023
902895a
eslint-plugin-react: Detect React version
victorlin May 2, 2023
74f76ad
eslint: Section by "code quality" and "code style" rules
victorlin May 4, 2023
a9aab1d
Use a src-specific ESLint config file
victorlin May 4, 2023
71c0709
eslint: Add custom rules
victorlin May 4, 2023
9fc42f0
eslint: Address no-use-before-define violations
victorlin May 4, 2023
93ee800
eslint: Address prefer-const violations
victorlin May 4, 2023
eb0c592
eslint: Address no-unneeded-ternary violations
victorlin May 4, 2023
cf2b541
eslint: Address no-console violations
victorlin May 4, 2023
5c9c8ca
Remove unused triggerOutboundEvent
victorlin May 4, 2023
09b5f3f
eslint: Enable react/no-array-index-key
victorlin May 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
victorlin marked this conversation as resolved.
Show resolved Hide resolved
- plugin:react-hooks/recommended

plugins:
jameshadfield marked this conversation as resolved.
Show resolved Hide resolved
- 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