Skip to content

Commit 72808e9

Browse files
committed
Add Prettier and ESLint config files and format code for consistency.
1 parent 691ad82 commit 72808e9

33 files changed

+2555
-1156
lines changed

.prettierignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# build directories
2+
**/dist
3+
.angular
4+
5+
# generated files
6+
src/schemas/*.validator.*

.vscode/settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint",
3+
"editor.formatOnType": false, // required
4+
"editor.formatOnPaste": true, // optional
5+
"editor.formatOnSave": true, // optional
6+
"editor.formatOnSaveMode": "file", // required to format on save
7+
"files.autoSave": "onFocusChange", // optional but recommended
8+
"vs-code-prettier-eslint.prettierLast": false // set as "true" to run 'prettier' last not first
9+
}

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# vhs-ext
1+
# semantic-history-search
2+
3+
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
24

35
A Chrome extension to provide semantic search over your browsing history. It goes beyond simple keyword matching of page titles, analysing the content of visited sites and allowing you to find previously visited pages based on their meaning and relevance to your queries. This provides intuitive rediscovery of previously visited sites or specific content from your history.
46

angular.json

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": 1,
44
"newProjectRoot": "projects",
55
"projects": {
6-
"vhs-ext": {
6+
"shs-ext": {
77
"projectType": "application",
88
"schematics": {},
99
"root": "",
@@ -16,22 +16,18 @@
1616
"customWebpackConfig": {
1717
"path": "./custom-webpack.config.ts"
1818
},
19-
"outputPath": "dist/vhs-ext",
19+
"outputPath": "dist/shs-ext",
2020
"index": "src/index.html",
2121
"main": "src/main.ts",
22-
"polyfills": [
23-
"zone.js"
24-
],
22+
"polyfills": ["zone.js"],
2523
"tsConfig": "tsconfig.app.json",
2624
"assets": [
2725
{
2826
"glob": "**/*",
2927
"input": "public"
3028
}
3129
],
32-
"styles": [
33-
"src/styles.css"
34-
],
30+
"styles": ["src/styles.css"],
3531
"scripts": []
3632
},
3733
"configurations": {
@@ -56,7 +52,7 @@
5652
"inlineCritical": false
5753
},
5854
"fonts": false
59-
},
55+
}
6056
},
6157
"development": {
6258
"optimization": false,
@@ -70,10 +66,10 @@
7066
"builder": "@angular-devkit/build-angular:dev-server",
7167
"configurations": {
7268
"production": {
73-
"buildTarget": "vhs-ext:build:production"
69+
"buildTarget": "shs-ext:build:production"
7470
},
7571
"development": {
76-
"buildTarget": "vhs-ext:build:development"
72+
"buildTarget": "shs-ext:build:development"
7773
}
7874
},
7975
"defaultConfiguration": "development"
@@ -84,20 +80,15 @@
8480
"test": {
8581
"builder": "@angular-devkit/build-angular:karma",
8682
"options": {
87-
"polyfills": [
88-
"zone.js",
89-
"zone.js/testing"
90-
],
83+
"polyfills": ["zone.js", "zone.js/testing"],
9184
"tsConfig": "tsconfig.spec.json",
9285
"assets": [
9386
{
9487
"glob": "**/*",
9588
"input": "public"
9689
}
9790
],
98-
"styles": [
99-
"src/styles.css"
100-
],
91+
"styles": ["src/styles.css"],
10192
"scripts": []
10293
}
10394
}

custom-webpack.config.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
// see https://www.npmjs.com/package/@angular-builders/custom-webpack
2-
import type { Configuration } from 'webpack';
2+
import type { Configuration } from "webpack";
33

44
// Note: AJV transforms/compiles a JSON Schema to an actual JS function. You can then call that function
55
// to validate input against said schema. BUT, to generate the function AJV uses dynamic code
66
// evaluation, which means doing this at runtime exposes us to the risk of code injection. To avoid
77
// this (and the need to add 'unsafe-eval' to our CSP in manifest.json) we use webpack's compile hook
88
// hook to "pre-compile" our validator function(s).
9-
import { compile } from './utils/ajv-utils';
9+
import { compile } from "./utils/ajv-utils";
1010

1111
export default {
12-
entry: {
13-
background: 'src/background.ts',
14-
content: 'src/content.ts'
12+
entry: {
13+
background: "src/background.ts",
14+
content: "src/content.ts",
15+
},
16+
plugins: [
17+
{
18+
apply: (compiler) => {
19+
compiler.hooks.compile.tap("AjvPlugin", (_params) => {
20+
compile({ schema: "src/schemas/settings.json", useDefaults: true });
21+
});
22+
},
1523
},
16-
plugins: [
17-
{
18-
apply: (compiler) => {
19-
compiler.hooks.compile.tap("AjvPlugin", (_params) => {
20-
compile( { schema: "src/schemas/settings.json", useDefaults: true } );
21-
});
22-
},
23-
},
24-
],
25-
optimization: {
26-
runtimeChunk: false
27-
},
28-
node: {
29-
global: true // Fix for "Uncaught ReferenceError: global is not defined" when importing Pinecone
30-
},
31-
experiments: {
32-
topLevelAwait: true // Fix for "Module parse failed: The top-level-await experiment is not enabled" when instantiating PineconeStore
33-
}
24+
],
25+
optimization: {
26+
runtimeChunk: false,
27+
},
28+
node: {
29+
global: true, // Fix for "Uncaught ReferenceError: global is not defined" when importing Pinecone
30+
},
31+
experiments: {
32+
topLevelAwait: true, // Fix for "Module parse failed: The top-level-await experiment is not enabled" when instantiating PineconeStore
33+
},
3434
} as Configuration;

0 commit comments

Comments
 (0)