Skip to content

Commit

Permalink
Upgrade lint warnings to errors.
Browse files Browse the repository at this point in the history
Configures lint so that every warning (expect for no-explicit-any, no-var-requires, and no-require-imports) will now be considered errors.
Also removes the remaining  warnings missed by the previous PRs.
  • Loading branch information
GabrielBruno24 committed Jan 8, 2025
1 parent baf2eb4 commit d74eb09
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 26 deletions.
36 changes: 18 additions & 18 deletions configs/base.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,32 @@
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-require-imports": "warn",
"arrow-parens": ["error", "always"],
"brace-style": ["warn", "1tbs", { "allowSingleLine": true }],
"constructor-super": "warn",
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
"constructor-super": "error",
"n/no-missing-require": ["error", {
"tryExtensions": [".js", ".json", ".node", ".ts"]
}],
"indent": ["warn", 4, {"VariableDeclarator": 0}],
"indent": ["error", 4, {"VariableDeclarator": 0}],
"linebreak-style": ["error", "unix"],
"no-dupe-keys": "warn",
"no-empty": "warn",
"no-dupe-keys": "error",
"no-empty": "error",
"no-empty-function": "error",
"no-unexpected-multiline": "warn",
"no-constant-condition": "warn",
"no-this-before-super": "warn",
"no-import-assign": "warn",
"no-irregular-whitespace": "warn",
"no-unexpected-multiline": "error",
"no-constant-condition": "error",
"no-this-before-super": "error",
"no-import-assign": "error",
"no-irregular-whitespace": "error",
"no-trailing-spaces": "error",
"no-const-assign": "warn",
"no-mixed-spaces-and-tabs": "warn",
"no-useless-escape": "warn",
"no-cond-assign": "warn",
"no-dupe-else-if": "warn",
"no-const-assign": "error",
"no-mixed-spaces-and-tabs": "error",
"no-useless-escape": "error",
"no-cond-assign": "error",
"no-dupe-else-if": "error",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["warn", { "vars": "all", "args": "after-used", "argsIgnorePattern": "^_", "ignoreRestSiblings": false }],
"object-curly-spacing": ["warn", "always"],
"@typescript-eslint/no-unused-vars": ["error", { "vars": "all", "args": "after-used", "argsIgnorePattern": "^_", "ignoreRestSiblings": false }],
"object-curly-spacing": ["error", "always"],
"semi": ["error", "always"],
"quotes": ["warn", "single"]
"quotes": ["error", "single"]
}
}

4 changes: 2 additions & 2 deletions configs/gts.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"eol-last": "error",
"prefer-arrow-callback": "error",
"no-trailing-spaces": "error",
"quotes": ["warn", "single", { "avoidEscape": true }],
"quotes": ["error", "single", { "avoidEscape": true }],
"no-restricted-properties": [
"error",
{
Expand All @@ -35,7 +35,7 @@
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@typescript-eslint/ban-ts-comment": "warn",
"@typescript-eslint/ban-ts-comment": "error",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-warning-comments": "off",
Expand Down
8 changes: 4 additions & 4 deletions configs/react.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"node": true
},
"rules": {
"react/prop-types": "warn",
"react/no-string-refs": "warn",
"react/no-unescaped-entities": "warn",
"react/display-name": "warn"
"react/prop-types": "error",
"react/no-string-refs": "error",
"react/no-unescaped-entities": "error",
"react/display-name": "error"
},
"parserOptions": {
"ecmaFeatures": {
Expand Down
2 changes: 2 additions & 0 deletions packages/chaire-lib-backend/src/config/dotenv.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,6 @@ const dotEnvPath = getDotEnvFile();
if (dotEnvPath !== null) {
console.log(`Using .env file from ${dotEnvPath}`);
}

/* eslint-disable-next-line */
export default require('dotenv').config({ path: dotEnvPath });
2 changes: 2 additions & 0 deletions packages/chaire-lib-backend/src/config/knexfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* This file is licensed under the MIT License.
* License text available at https://opensource.org/licenses/MIT
*/

/* eslint-disable-next-line @typescript-eslint/no-require-imports */
require('./dotenv.config'); // dotenv is required to get the connection strings
import config from './server.config';
// TODO Let this data be in the config file instead, but only when the server config is separate from project config to not leak data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
import url from 'url';
// TODO replace this fetch-retry library with one compatible with TS
/* eslint-disable-next-line */
const fetchRetry = require('@zeit/fetch-retry')(require('node-fetch'));

// Only do 4 retries instead of the default 5, as the retry period increases at
Expand Down
1 change: 1 addition & 0 deletions packages/chaire-lib-backend/src/utils/osrm/OSRMMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import * as Status from 'chaire-lib-common/lib/utils/Status';
import { TransitionRouteOptions, TransitionMatchOptions } from 'chaire-lib-common/lib/api/OSRMRouting';

//TODO replace this fetch-retry library with one compatible with TS
/* eslint-disable-next-line */
const fetch = require('@zeit/fetch-retry')(require('node-fetch'));

type OSRMServiceTypes = 'route' | 'nearest' | 'table' | 'match' | 'trip' | 'tile';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

//TODO replace this fetch-retry library with one compatible with TS
/* eslint-disable-next-line */
const fetch = require('@zeit/fetch-retry')(require('node-fetch'));

import ServerConfig from '../../config/ServerConfig';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import * as RoutingService from './RoutingService';
import * as turf from '@turf/turf';
import _cloneDeep from 'lodash/cloneDeep';
import { TripRoutingQueryAttributes } from './types';

/**
* This class provides routing services using manual routing. This mode will always return return results
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/
import GeoJSON from 'geojson';
import { RoutingMode } from '../../config/routingModes';
import { TripRoutingQueryAttributes } from './types';

// FIXME Make sure these parameters are those that apply to map matching as the name implies
export interface MapMatchParameters {
Expand Down

0 comments on commit d74eb09

Please sign in to comment.