Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

9,406 changes: 4,789 additions & 4,617 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

39 changes: 0 additions & 39 deletions common/scripts/.eslintrc.ts.base.json

This file was deleted.

9 changes: 0 additions & 9 deletions common/scripts/.eslintrc.ts.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"extends": ["./.eslintrc.ts.base.json"],
"rules": {
const baseConfig = require("./eslint.base.config.js");

module.exports = {
...baseConfig,
rules: {
...(baseConfig.rules),
"simple-import-sort/sort": "error",
"@typescript-eslint/no-inferrable-types": "error",
"curly": "error",
curly: "error",
"react-hooks/exhaustive-deps": "off",
"@typescript-eslint/consistent-type-imports": "error"
}
}
};
57 changes: 57 additions & 0 deletions common/scripts/eslint.base.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
const tsPlugin = require("@typescript-eslint/eslint-plugin");
const tsParser = require("@typescript-eslint/parser");
const react = require("eslint-plugin-react");
const prettier = require("eslint-plugin-prettier");
const simpleImportSort = require("eslint-plugin-simple-import-sort");
const reactHooks = require("eslint-plugin-react-hooks");
const iTwinPlugin = require("@itwin/eslint-plugin");
const reactApp = require("eslint-config-react-app");

module.exports = {
files: ["**/*.{ts,tsx}"],
...iTwinPlugin.configs.iTwinjsRecommendedConfig,
languageOptions: {
ecmaVersion: 2022,
sourceType: "module",
parser: tsParser,
parserOptions: {
project: "./tsconfig.json",
},
},
plugins: {
"@typescript-eslint": tsPlugin,
react,
"simple-import-sort": simpleImportSort,
"react-hooks": reactHooks,
"react-app": reactApp,
prettier,
},
rules: {
...react.configs.recommended.rules,
"no-console": "off",
"no-var": "error",
"import/prefer-default-export": "off",
radix: "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/interface-name-prefix": "off",
"react/no-unescaped-entities": "off",
"react/display-name": "off",
"react/prop-types": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["warn", { ignoreRestSiblings: true }],
"@typescript-eslint/no-deprecated": "error",
},
settings: {
"import/resolver": {
node: {
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
},
react: {
version: "detect",
}
}
};
12 changes: 12 additions & 0 deletions common/scripts/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const baseConfig = require("./eslint.base.config.js");

module.exports = {
...baseConfig,
rules: {
...(baseConfig.rules),
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/prefer-optional-chain": "warn",
"@typescript-eslint/prefer-nullish-coalescing": "warn",
"react-hooks/exhaustive-deps": "warn",
},
};
38 changes: 17 additions & 21 deletions common/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,24 @@
"license": "MIT",
"repository": "https://github.com/itwin/viewer/tree/main/common/scripts",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.5.0",
"@typescript-eslint/parser": "^4.5.0",
"eslint": "^7.11.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^6.11.0",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-deprecation": "1.2.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-prefer-arrow": "^1.1.7",
"eslint-plugin-prettier": "^3.1.4",
"@typescript-eslint/eslint-plugin": "^8.32.0",
"@typescript-eslint/parser": "^8.32.0",
"@itwin/eslint-plugin": "^5.1.0",
"eslint": "^9.13.0",
"eslint-config-prettier": "^10.0.1",
"eslint-config-react-app": "^7.0.0",
"eslint-plugin-prettier": "^5.4.0",
"eslint-plugin-react": "^7.20.3",
"eslint-plugin-react-hooks": "^4.0.7",
"eslint-plugin-simple-import-sort": "^5.0.3",
"lint-staged": "^10.2.11",
"prettier": "^2.0.5",
"stylelint": "^13.6.1",
"stylelint-config-prettier": "^8.0.2",
"stylelint-config-sass-guidelines": "^7.0.0",
"stylelint-prettier": "^1.1.2",
"stylelint-scss": "^3.18.0"
"eslint-plugin-react-hooks": "^5.0.2",
"eslint-plugin-simple-import-sort": "^12.1.1",
"lint-staged": "^11.2.6",
"prettier": "^3.5.3",
"typescript-eslint": "^8.32.0",
"stylelint": "^16.19.1",
"stylelint-config-prettier": "^9.0.5",
"stylelint-config-sass-guidelines": "^12.1.0",
"stylelint-prettier": "^5.0.3",
"stylelint-scss": "^6.12.0"
},
"scripts": {
"build": "",
Expand Down
4 changes: 2 additions & 2 deletions common/scripts/pre-commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ async function preCommit() {
config: {
"*.{ts,tsx}": [
"node ./common/scripts/copyright-linter.js --",
"node --max_old_space_size=4096 ./common/scripts/node_modules/eslint/bin/eslint.js --config ./common/scripts/.eslintrc.ts.autofix.json --ignore-path ./.eslintignore --resolve-plugins-relative-to ./common/scripts --fix",
"node --max_old_space_size=4096 ./common/scripts/node_modules/eslint/bin/eslint.js --config ./common/scripts/eslint.autofix.config.js --ignore-pattern **/node_modules/** --fix",
"node ./common/scripts/node_modules/prettier --write --config ./.prettierrc --ignore-path ./.prettierignore",
"node --max_old_space_size=4096 ./common/scripts/node_modules/eslint/bin/eslint.js --config ./common/scripts/.eslintrc.ts.json --ignore-path ./.eslintignore --color --resolve-plugins-relative-to ./common/scripts",
"node --max_old_space_size=4096 ./common/scripts/node_modules/eslint/bin/eslint.js --config ./common/scripts/eslint.autofix.config.js --ignore-pattern **/node_modules/** --color",
],
"*.{md,json}": [
"node ./common/scripts/node_modules/prettier --write --config ./.prettierrc --ignore-path ./.prettierignore",
Expand Down
12 changes: 12 additions & 0 deletions packages/apps/desktop-viewer-test/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const config = require("../../../common/scripts/eslint.config.js");
module.exports = {
...config,
languageOptions: {
...config.languageOptions,
parserOptions: {
...config.languageOptions.parserOptions,
tsconfigRootDir: __dirname,
project: ["./tsconfig.json", "./tsconfig.backend.json"],
},
},
};
15 changes: 2 additions & 13 deletions packages/apps/desktop-viewer-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"copy:enUS": "cpx \"./build/locales/en/*\" ./build/locales/en-US/",
"electron": "electron lib/backend/main.js",
"electron:debug": "cross-env NODE_ENV=development electron lib/backend/main.js",
"lint": "eslint --config package.json --resolve-plugins-relative-to ../../../common/scripts/ --no-eslintrc \"./src/**/*.{ts,tsx}\" 1>&2",
"lint": "eslint \"./src/**/*.{ts,tsx}\" 1>&2",
"lint:fix": "npm run -s lint -- --fix",
"start": "npm run build:backend && run-p \"start:frontend\" \"electron:debug\"",
"start:frontend": "react-scripts start",
Expand Down Expand Up @@ -98,18 +98,7 @@
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
"sass": "^1.64.2",
"typescript": "~5.0.4",
"typescript": "~5.6.2",
"webpack": "^5.94.0"
},
"eslintConfig": {
"extends": [
"../../../common/scripts/.eslintrc.ts.json"
],
"parserOptions": {
"project": [
"./tsconfig.json",
"./tsconfig.backend.json"
]
}
}
}
11 changes: 6 additions & 5 deletions packages/apps/desktop-viewer-test/src/backend/main.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/

import { IModelHostConfiguration, IpcHost } from "@itwin/core-backend";
import { Logger, LogLevel } from "@itwin/core-bentley";
import type { ElectronHostOptions } from "@itwin/core-electron/lib/cjs/ElectronBackend";
import { ElectronHost } from "@itwin/core-electron/lib/cjs/ElectronBackend";
import { BackendIModelsAccess } from "@itwin/imodels-access-backend";
import { ECSchemaRpcImpl } from "@itwin/ecschema-rpcinterface-impl";
import { BackendIModelsAccess } from "@itwin/imodels-access-backend";
import { Presentation } from "@itwin/presentation-backend";
import dotenvFlow from "dotenv-flow";
import { Menu, shell } from "electron";
import type { MenuItemConstructorOptions } from "electron/main";
import * as path from "path";
Expand All @@ -19,7 +20,7 @@ import { channelName, viewerRpcs } from "../common/ViewerConfig";
import { appInfo } from "./AppInfo";
import ViewerHandler from "./ViewerHandler";

require("dotenv-flow").config(); // eslint-disable-line @typescript-eslint/no-var-requires
dotenvFlow.config();

/** This is the function that gets called when we start iTwinViewer via `electron ViewerMain.js` from the command line.
* It runs in the Electron main process and hosts the iModeljs backend (IModelHost) code. It starts the render (frontend) process
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const viewerRpcs = [
IModelReadRpcInterface,
IModelTileRpcInterface,
PresentationRpcInterface,
SnapshotIModelRpcInterface,
SnapshotIModelRpcInterface, // eslint-disable-line @typescript-eslint/no-deprecated
ECSchemaRpcInterface,
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class ITwinViewerApp {
const makeIpcCall =
<T extends keyof IpcMethods>(methodName: T) =>
async (args: Parameters<IpcMethods[T]>) =>
IpcApp.callIpcChannel(
IpcApp.callIpcChannel( // eslint-disable-line @typescript-eslint/no-deprecated
channelName,
methodName,
args
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const SelectITwin = () => {
placeholder={"Search by name or number"}
title={"Search"}
/>
<SearchBox.Button title="Search button" onClick={startSearch} />
<SearchBox.Button label="Search button" onClick={startSearch} />
</SearchBox>
</div>
<ITwinGrid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const ViewerRoute = () => {
}),
],
},
new PropertyGridUiItemsProvider({
new PropertyGridUiItemsProvider({ // eslint-disable-line @typescript-eslint/no-deprecated
propertyGridProps: {
autoExpandChildCategories: true,
ancestorsNavigationControls: (props) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ export class IModelMergeItemsProvider implements UiItemsProvider {
const statusBarItems: StatusBarItem[] = [];
if (stageUsage === StageUsage.General) {
statusBarItems.push(
StatusBarItemUtilities.createCustomItem(
StatusBarItemUtilities.createCustomItem( // eslint-disable-line @typescript-eslint/no-deprecated
"IModelMergeItemsProvider:ConnectionStatusBarItem",
StatusBarSection.Center,
1,
<ConnectionStatusBarItem />
)
);
statusBarItems.push(
StatusBarItemUtilities.createCustomItem(
StatusBarItemUtilities.createCustomItem( // eslint-disable-line @typescript-eslint/no-deprecated
"IModelMergeItemsProvider:IModelMergeStatusBarItem",
StatusBarSection.Center,
3,
Expand Down
2 changes: 1 addition & 1 deletion packages/apps/desktop-viewer-test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
"node_modules",
"./src/backend/**/*.ts"
]
}
}
2 changes: 1 addition & 1 deletion packages/apps/web-viewer-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@types/node": "^20",
"@types/react": "^18.2.18",
"@types/react-dom": "^18.2.7",
"typescript": "~5.0.4"
"typescript": "~5.6.2"
},
"browserslist": [
">0.2%",
Expand Down
12 changes: 12 additions & 0 deletions packages/modules/desktop-viewer-react/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const config = require("../../../common/scripts/eslint.config.js");

module.exports = {
...config,
languageOptions: {
...config.languageOptions,
parserOptions: {
...config.languageOptions.parserOptions,
tsconfigRootDir: __dirname,
},
},
};
16 changes: 3 additions & 13 deletions packages/modules/desktop-viewer-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"test-watch": "jest --watch",
"clean": "rimraf lib",
"rebuild": "npm run clean && npm run build",
"lint": "eslint --config package.json --resolve-plugins-relative-to ../../../common/scripts/ --no-eslintrc \"./src/**/*.{ts,tsx}\" 1>&2",
"lint": "eslint \"src/**/*.ts*\" 1>&2",
"lint:fix": "npm run -s lint -- --fix"
},
"dependencies": {
Expand Down Expand Up @@ -61,7 +61,7 @@
"@types/react-dom": "^18.2.4",
"@types/react-redux": "^7.1.9",
"concurrently": "^5.2.0",
"eslint": "^7.11.0",
"eslint": "^9.13.0",
"copyfiles": "^2.1.0",
"electron": "^24.8.3",
"identity-obj-proxy": "^3.0.0",
Expand Down Expand Up @@ -117,15 +117,5 @@
"iModel",
"iModelJs",
"iTwin"
],
"eslintConfig": {
"extends": [
"../../../common/scripts/.eslintrc.ts.json"
],
"parserOptions": {
"project": [
"./tsconfig.json"
]
}
}
]
}
Loading
Loading