Skip to content

Commit 7f8aa18

Browse files
committed
style: Reformat code with Prettier
1 parent d496811 commit 7f8aa18

9 files changed

+65
-21
lines changed

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lib
2+
node_modules

.eslintrc.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2021": true
5+
},
6+
"extends": [
7+
"eslint:recommended",
8+
"plugin:@typescript-eslint/recommended",
9+
"prettier"
10+
],
11+
"parser": "@typescript-eslint/parser",
12+
"parserOptions": {
13+
"ecmaVersion": "latest",
14+
"sourceType": "module"
15+
},
16+
"plugins": ["@typescript-eslint"],
17+
"rules": {
18+
"indent": ["error", 4],
19+
"linebreak-style": ["error", "unix"],
20+
"quotes": ["error", "double"],
21+
"semi": ["error", "always"],
22+
"@typescript-eslint/no-unused-vars": "warn"
23+
}
24+
}

.husky/pre-commit

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

.lintstagedrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"*.ts": ["eslint --fix", "prettier --write"]
3+
}

.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lib
2+
node_modules

.prettierrc.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"trailingComma": "all",
3+
"tabWidth": 4,
4+
"semi": true,
5+
"singleQuote": false
6+
}

lib/condition/condition.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ export function empty_condition(): Condition {
2929
export function parse_condition(source: string, baseIRI: string): Condition {
3030
const shapeQuads = new Parser().parse(SHAPES);
3131
const output = extractShapes(shapeQuads, {
32-
"https://w3id.org/tree#And": (obj) => new AndCondition(obj),
33-
"https://w3id.org/tree#Or": (obj) => new OrCondition(obj),
34-
"https://w3id.org/tree#Condition": (obj) => new LeafCondition(obj),
32+
"https://w3id.org/tree#And": (obj: any) => new AndCondition(obj),
33+
"https://w3id.org/tree#Or": (obj: any) => new OrCondition(obj),
34+
"https://w3id.org/tree#Condition": (obj: any) => new LeafCondition(obj),
3535
});
3636

3737
const dataQuads = new Parser({ baseIRI: baseIRI }).parse(source);
3838

39-
return output.lenses[
40-
"https://w3id.org/rdf-lens/ontology#TypedExtract"
41-
].execute({
39+
return <Condition>output.lenses[
40+
"https://w3id.org/rdf-lens/ontology#TypedExtract"
41+
].execute({
4242
quads: dataQuads,
4343
id: new NamedNode(baseIRI),
4444
});

package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,15 @@
4747
"@rdfjs/types": "^1.1.0",
4848
"@types/n3": "^1.16.4",
4949
"@types/node": "^20.12.4",
50+
"@typescript-eslint/eslint-plugin": "^8.2.0",
51+
"@typescript-eslint/parser": "^8.2.0",
5052
"benchmark": "^2.1.4",
53+
"eslint": "^9.9.0",
54+
"eslint-config-prettier": "^9.1.0",
55+
"husky": "^9.1.5",
5156
"jest": "^29.7.0",
52-
"prettier": "^3.2.5",
57+
"lint-staged": "^15.2.9",
58+
"prettier": "^3.3.3",
5359
"ts-jest": "^29.1.2",
5460
"tsc-alias": "^1.8.10",
5561
"typescript": "^5.4.3"

tests/rdf-connect/ldes-client.test.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ describe("Functional tests for the js:LdesClient Connector Architecture function
249249
outputStream.data(record => {
250250
const store = RdfStore.createDefault();
251251
new Parser().parse(record).forEach(q => store.addQuad(q));
252-
252+
253253
// Check which classes we got
254254
for (const classSuffix of observedClasses.keys()) {
255255
if (record.includes(classSuffix)) {
@@ -263,13 +263,13 @@ describe("Functional tests for the js:LdesClient Connector Architecture function
263263
!record.includes("<https://www.w3.org/ns/activitystreams#Delete>")
264264
) {
265265
expect(store.getQuads(
266-
null,
267-
RDF.terms.type,
266+
null,
267+
RDF.terms.type,
268268
df.namedNode("http://www.opengis.net/ont/geosparql#Geometry")
269269
).length).toBe(1);
270270
expect(store.getQuads(
271-
null,
272-
df.namedNode(GSP.custom("asWKT"))
271+
null,
272+
df.namedNode(GSP.custom("asWKT"))
273273
).length).toBe(1);
274274
}
275275
count++;
@@ -318,7 +318,7 @@ describe("Functional tests for the js:LdesClient Connector Architecture function
318318
outputStream.data(record => {
319319
const store = RdfStore.createDefault();
320320
new Parser().parse(record).forEach(q => store.addQuad(q));
321-
321+
322322
// Check which classes we got
323323
for (const classSuffix of observedClasses.keys()) {
324324
if (record.includes(classSuffix)) {
@@ -332,13 +332,13 @@ describe("Functional tests for the js:LdesClient Connector Architecture function
332332
!record.includes("<https://www.w3.org/ns/activitystreams#Delete>")
333333
) {
334334
expect(store.getQuads(
335-
null,
336-
RDF.terms.type,
335+
null,
336+
RDF.terms.type,
337337
df.namedNode(GSP.custom("Geometry"))
338338
).length).toBe(1);
339339
expect(store.getQuads(
340-
null,
341-
df.namedNode(GSP.custom("asWKT"))
340+
null,
341+
df.namedNode(GSP.custom("asWKT"))
342342
).length).toBe(1);
343343
}
344344
count++;
@@ -386,7 +386,7 @@ describe("Functional tests for the js:LdesClient Connector Architecture function
386386
outputStream.data(record => {
387387
const store = RdfStore.createDefault();
388388
new Parser().parse(record).forEach(q => store.addQuad(q));
389-
389+
390390
// Check which classes we got
391391
for (const classSuffix of observedClasses.keys()) {
392392
if (record.includes(classSuffix)) {
@@ -400,8 +400,8 @@ describe("Functional tests for the js:LdesClient Connector Architecture function
400400
!record.includes("<https://www.w3.org/ns/activitystreams#Delete>")
401401
) {
402402
expect(store.getQuads(
403-
null,
404-
RDF.terms.type,
403+
null,
404+
RDF.terms.type,
405405
df.namedNode("http://www.opengis.net/ont/geosparql#Geometry")
406406
).length).toBe(0);
407407
}
@@ -428,4 +428,4 @@ describe("Functional tests for the js:LdesClient Connector Architecture function
428428
// Check we saw all expected classes
429429
expect(Array.from(observedClasses.values()).every(v => v === true)).toBeTruthy();
430430
});
431-
});
431+
});

0 commit comments

Comments
 (0)