Skip to content

Commit

Permalink
Merge branch 'main' into custom-patterns
Browse files Browse the repository at this point in the history
* main:
  Upgrade @1password/eslint-config and @typescript-eslint/eslint-plugin, add eslint, remove eslint-plugin-jsdoc eslint-plugin-prettier eslint-plugin-sonarjs eslint-plugin-unicorn
  Bump ts-jest
  Bump lint-staged
  Update esbuild esbuild-register husky license-checker-rseidelsohn lint-staged
  Bump Typescript to 5.4.5
  Update prettier deps
  Update Test and Publish workflow Node version
  Partially update jest.config.js to support Winddows
  Update build and eslint commands to support running on Windows
  Bump to node 18.18.0
  Ignore instances of ${{ ... }} when creating a CodeLens suggestion
  • Loading branch information
jodyheavener committed May 22, 2024
2 parents 7e9be5b + 5ed6d6a commit 2c6a21c
Show file tree
Hide file tree
Showing 15 changed files with 1,936 additions and 1,320 deletions.
7 changes: 4 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"extends": [
"@1password"
],
"extends": "@1password/eslint-config",
"overrides": [
{
"files": [
Expand All @@ -16,10 +14,13 @@
"unicorn/prefer-node-protocol": "off",
"no-shadow": "off",
"unicorn/filename-case": "off",
"unicorn/no-object-as-default-parameter": "off",
"jsdoc/require-jsdoc": "off",
"import/order": "off",
"@typescript-eslint/no-shadow": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-enum-comparison": "off",
"@typescript-eslint/naming-convention": [
"warn",
{
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- run: yarn install --frozen-lockfile
- name: Publish to Open VSX Registry
uses: HaaLeo/publish-vscode-extension@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 16
node-version: 18
- run: yarn
- run: yarn typecheck
- run: yarn eslint
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.12.0
v18.18.0
13 changes: 9 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
const path = require("path");

/** @type {import('@jest/types/build/Config').DefaultOptions} */
module.exports = {
roots: ["<rootDir>"],
testMatch: ["<rootDir>/src/**/?(*.)+(test).[tj]s"],
testMatch: ["<rootDir>/src/**/*.@(test).[tj]s"],
testEnvironment: "jest-environment-jsdom",
preset: "ts-jest/presets/js-with-ts",
transform: {
"^.+\\.(ts|js)?$": "ts-jest",
},
testPathIgnorePatterns: ["<rootDir>/dist", "<rootDir>/node_modules"],
testPathIgnorePatterns: [
path.join("<rootDir>", "dist"),
path.join("<rootDir>", "node_modules"),
],
moduleNameMapper: {
vscode: "<rootDir>/test/vscode-mock.ts",
vscode: path.join("<rootDir>", "test", "vscode-mock.ts"),
},
setupFilesAfterEnv: ["<rootDir>/test/jest.setup.ts"],
setupFilesAfterEnv: [path.join("<rootDir>", "test", "jest.setup.ts")],
};
37 changes: 17 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
],
"engines": {
"vscode": "^1.66.0",
"node": "^16.12.0"
"node": "^18.18.0"
},
"scripts": {
"build": "license-checker-rseidelsohn --direct --files licenses && NODE_ENV=production yarn compile",
"build": "license-checker-rseidelsohn --direct --files licenses && cross-env NODE_ENV=production yarn compile",
"compile": "node -r esbuild-register compile.ts",
"eslint": "eslint -c .eslintrc.json 'src/**/*.ts'",
"eslint": "cross-env eslint -c .eslintrc.json \"src/**/*.ts\"",
"prepare": "husky install",
"prettier": "prettier --check src/",
"test": "jest",
Expand Down Expand Up @@ -207,30 +207,27 @@
"yaml-ast-parser": "^0.0.43"
},
"devDependencies": {
"@1password/eslint-config": "^1.0.0",
"@1password/prettier-config": "^1.1.2",
"@1password/eslint-config": "^4.3.0",
"@1password/prettier-config": "^1.1.3",
"@types/jest": "^27.4.1",
"@types/json-to-ast": "^2.1.2",
"@types/node": "20.8.6",
"@types/uuid": "^9.0.1",
"@types/vscode": "^1.66.0",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"esbuild": "^0.19.4",
"esbuild-register": "^3.4.2",
"eslint-plugin-jsdoc": "^46.2.6",
"eslint-plugin-no-unsanitized": "^4.0.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-sonarjs": "^0.19.0",
"eslint-plugin-unicorn": "^40.1.0",
"@typescript-eslint/eslint-plugin": "^7.10.0",
"cross-env": "^7.0.3",
"esbuild": "^0.21.3",
"esbuild-register": "^3.5.0",
"eslint": "^8.57.0",
"fishery": "^2.2.2",
"husky": "^8.0.3",
"husky": "^9.0.11",
"jest": "^27.5.1",
"license-checker-rseidelsohn": "^3.3.0",
"lint-staged": "^13.1.2",
"prettier": "^3.0.1",
"prettier-plugin-organize-imports": "^3.2.3",
"ts-jest": "^27.1.4",
"typescript": "^4.8.4",
"license-checker-rseidelsohn": "^4.3.0",
"lint-staged": "^15.2.4",
"prettier": "^3.2.5",
"prettier-plugin-organize-imports": "^3.2.4",
"ts-jest": "^29.1.3",
"typescript": "^5.4.5",
"uuid": "^9.0.0",
"yaml": "^2.3.1"
}
Expand Down
2 changes: 1 addition & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const createErrorHandler =
};

export class CLI {
valid = false;
public valid = false;

public constructor() {
setClientInfo({
Expand Down
1 change: 1 addition & 0 deletions src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Config {
);
}

/* eslint-disable-next-line @typescript-eslint/naming-convention */
private _onDidChange = new EventEmitter<ConfigurationChangeEvent>();
public get onDidChange(): Event<ConfigurationChangeEvent> {
return this._onDidChange.event;
Expand Down
2 changes: 1 addition & 1 deletion src/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { provideDocumentLinks } from "./language-providers/document-link";
import { provideHover } from "./language-providers/hover";

export class Editor {
subscriptions: Disposable[] = [];
private subscriptions: Disposable[] = [];

public constructor(private core: Core) {
this.configure();
Expand Down
2 changes: 1 addition & 1 deletion src/injection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { COMMANDS, EXTENSION_ID, REGEXP } from "./constants";
import type { Core } from "./core";

export class Injection {
activeDocument: TextDocument;
private activeDocument: TextDocument;

public constructor(private core: Core) {
this.core.context.subscriptions.push(
Expand Down
2 changes: 1 addition & 1 deletion src/items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export class Items {
? "What do you want this field to be called?"
: `What do you want to call the field with the value "${maskString(
fieldValue,
)}"?`,
)}"?`,
value: formatField(suggestedLabel),
ignoreFocusOut: true,
});
Expand Down
5 changes: 5 additions & 0 deletions src/language-providers/code-lens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ export const provideCodeLenses = (document: TextDocument): CodeLens[] => {

const matches = parser
.getMatches()
.filter(
// Ignore values within secret template variables
({ range, fieldValue, suggestion }) =>
!new RegExp(/\${{(.*?)}}/).test(fieldValue),
)
.filter((match) => patterns.patternsFilter(match.suggestion));

const customPatternsResult: PatternSuggestion[] =
Expand Down
6 changes: 3 additions & 3 deletions src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { COMMANDS, DEBUG, STATE } from "./constants";
import type { Core } from "./core";

export class Setup {
accountUuid?: string;
accountUrl?: string;
vaultId?: string;
public accountUuid?: string;
public accountUrl?: string;
public vaultId?: string;

public constructor(private core: Core) {
this.core.context.subscriptions.push(
Expand Down
1 change: 0 additions & 1 deletion src/url-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export const createInternalUrl = (

export const createOpenOPHandler =
(core: InstanceType<typeof Core>) =>
// eslint-disable-next-line unicorn/no-object-as-default-parameter
async ({ action, ...args }: { action: AppAction | "" } = { action: "" }) => {
const url = new URL(`onepassword://${action}`);

Expand Down
Loading

0 comments on commit 2c6a21c

Please sign in to comment.