Skip to content

Commit

Permalink
fix(sdk): Updates to eslint, and fixes from that (#423)
Browse files Browse the repository at this point in the history
- Use latest eslint and typescript
- Uncovered an error in a unit test for configurations, which should now be more strict
- TS 5.2+ requires 'node' style modules to load node_modules packages
  • Loading branch information
dmihalcik-virtru authored Feb 18, 2025
1 parent dfb1a6f commit fa9271d
Show file tree
Hide file tree
Showing 19 changed files with 3,264 additions and 5,869 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
path: ./lib/opentdf-sdk-*.tgz
- name: SonarCloud Scan
if: fromJSON(env.do_sonarscan)
uses: SonarSource/sonarcloud-github-action@master
uses: SonarSource/sonarqube-scan-action@v5.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand Down
9 changes: 0 additions & 9 deletions cli/.eslintrc.yaml

This file was deleted.

41 changes: 41 additions & 0 deletions cli/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import globals from "globals";
import path from "node:path";
import { fileURLToPath } from "node:url";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
import pluginChaiFriendly from "eslint-plugin-chai-friendly";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [...compat.extends("plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"), {
plugins: {
"chai-friendly": pluginChaiFriendly,
"@typescript-eslint": typescriptEslint,
},
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},

ecmaVersion: 5,
sourceType: "commonjs",

parserOptions: {
project: ["**/tsconfig.json"],
},

},
rules: {
// See https://www.npmjs.com/package/eslint-plugin-chai-friendly
"@typescript-eslint/no-unused-expressions": "off", // disable original rule
"chai-friendly/no-unused-expressions": "error"
},
}];
Loading

0 comments on commit fa9271d

Please sign in to comment.