Skip to content

Commit b6a1b5a

Browse files
committed
spaces not tabs
1 parent ade1c87 commit b6a1b5a

33 files changed

+1059
-1062
lines changed

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"useTabs": true,
2+
"useTabs": false,
33
"singleQuote": true,
44
"trailingComma": "none",
55
"printWidth": 100,

.vscode/settings.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

eslint.config.js

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,42 @@ import tsParser from '@typescript-eslint/parser';
99
import globals from 'globals';
1010

1111
export default [
12-
{
13-
ignores: ['.DS_Store', 'node_modules', 'build/', '.svelte-kit/', 'index.js']
14-
},
15-
js.configs.recommended,
16-
...tsEslint.configs.strict,
17-
...eslintPluginSvelte.configs['flat/recommended'],
18-
eslintPluginPrettierRecommended, // must be last to override conflicting rules.
19-
{
20-
languageOptions: {
21-
globals: {
22-
...globals.node,
23-
...globals.browser
24-
}
25-
}
26-
},
27-
{
28-
rules: {
29-
'no-console': 'off',
30-
'@typescript-eslint/no-non-null-assertion': 'off'
31-
}
32-
},
33-
{
34-
files: ['**/*.svelte'],
35-
languageOptions: {
36-
parser: svelteParser,
37-
parserOptions: {
38-
parser: tsParser
39-
}
40-
},
41-
rules: {
42-
'svelte/no-target-blank': 'error',
43-
'svelte/no-at-debug-tags': 'error',
44-
'svelte/no-reactive-functions': 'error',
45-
'svelte/no-reactive-literals': 'error',
46-
'svelte/no-at-html-tags': 'off'
47-
}
48-
}
12+
{
13+
ignores: ['.DS_Store', 'node_modules', 'build/', '.svelte-kit/', 'index.js']
14+
},
15+
js.configs.recommended,
16+
...tsEslint.configs.strict,
17+
...eslintPluginSvelte.configs['flat/recommended'],
18+
eslintPluginPrettierRecommended, // must be last to override conflicting rules.
19+
{
20+
languageOptions: {
21+
globals: {
22+
...globals.node,
23+
...globals.browser
24+
}
25+
}
26+
},
27+
{
28+
rules: {
29+
'no-console': 'off',
30+
'@typescript-eslint/no-non-null-assertion': 'off',
31+
'@typescript-eslint/no-explicit-any': 'off'
32+
}
33+
},
34+
{
35+
files: ['**/*.svelte'],
36+
languageOptions: {
37+
parser: svelteParser,
38+
parserOptions: {
39+
parser: tsParser
40+
}
41+
},
42+
rules: {
43+
'svelte/no-target-blank': 'error',
44+
'svelte/no-at-debug-tags': 'error',
45+
'svelte/no-reactive-functions': 'error',
46+
'svelte/no-reactive-literals': 'error',
47+
'svelte/no-at-html-tags': 'off'
48+
}
49+
}
4950
];

postcss.config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export default {
2-
plugins: {
3-
tailwindcss: {},
4-
autoprefixer: {}
5-
}
2+
plugins: {
3+
tailwindcss: {},
4+
autoprefixer: {}
5+
}
66
};

scripts/integrity-enforcement.ts

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,45 @@ import peopleRaw from '../static/people.json?raw';
33
import type { Paper, Person } from '../src/lib/app-types';
44

55
async function generateIndex() {
6-
const people = JSON.parse(peopleRaw) as Person[];
7-
const personMap = Object.fromEntries(people.map((p) => [`${p.first_name} ${p.last_name}`, p]));
8-
const paperList = await fs.readdir('./static/papers');
6+
const people = JSON.parse(peopleRaw) as Person[];
7+
const personMap = Object.fromEntries(people.map((p) => [`${p.first_name} ${p.last_name}`, p]));
8+
const paperList = await fs.readdir('./static/papers');
99

10-
const papers = [] as Paper[];
11-
for (const paper of paperList) {
12-
const paperRaw = await fs
13-
.readFile(`./static/papers/${paper}`, 'utf8')
14-
.then((x) => JSON.parse(x) as Paper);
15-
const updatedAuthors = paperRaw.authors.map((author) => {
16-
const key = `${author.first_name} ${author.last_name}`;
17-
const { url, display_name } = personMap[key] || {};
18-
return {
19-
...author,
20-
display_name: display_name || undefined,
21-
url: url || undefined
22-
};
23-
});
24-
const updatedPaper = {
25-
...paperRaw,
26-
authors: updatedAuthors
27-
};
28-
if (updatedPaper.visible) {
29-
papers.push(updatedPaper);
30-
}
31-
await fs.writeFile(`./static/papers/${paper}`, JSON.stringify(updatedPaper, null, 2));
32-
}
33-
papers.sort((a, b) => {
34-
const ad = a.mod_date;
35-
const bd = b.mod_date;
36-
const at = a.title;
37-
const bt = b.title;
38-
// sort by reverse mod date, break ties by alphabetic title order
39-
return ad < bd ? 1 : ad > bd ? -1 : at < bt ? -1 : at > bt ? 1 : 0;
40-
});
41-
await fs.writeFile('./static/papers-index.json', JSON.stringify(papers, null, 2));
10+
const papers = [] as Paper[];
11+
for (const paper of paperList) {
12+
const paperRaw = await fs
13+
.readFile(`./static/papers/${paper}`, 'utf8')
14+
.then((x) => JSON.parse(x) as Paper);
15+
const updatedAuthors = paperRaw.authors.map((author) => {
16+
const key = `${author.first_name} ${author.last_name}`;
17+
const { url, display_name } = personMap[key] || {};
18+
return {
19+
...author,
20+
display_name: display_name || undefined,
21+
url: url || undefined
22+
};
23+
});
24+
const updatedPaper = {
25+
...paperRaw,
26+
authors: updatedAuthors
27+
};
28+
if (updatedPaper.visible) {
29+
papers.push(updatedPaper);
30+
}
31+
await fs.writeFile(`./static/papers/${paper}`, JSON.stringify(updatedPaper, null, 2));
32+
}
33+
papers.sort((a, b) => {
34+
const ad = a.mod_date;
35+
const bd = b.mod_date;
36+
const at = a.title;
37+
const bt = b.title;
38+
// sort by reverse mod date, break ties by alphabetic title order
39+
return ad < bd ? 1 : ad > bd ? -1 : at < bt ? -1 : at > bt ? 1 : 0;
40+
});
41+
await fs.writeFile('./static/papers-index.json', JSON.stringify(papers, null, 2));
4242
}
4343

4444
async function main() {
45-
await generateIndex();
45+
await generateIndex();
4646
}
4747
main();

src/app.d.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// See https://kit.svelte.dev/docs/types#app
22
// for information about these interfaces
33
declare global {
4-
namespace App {
5-
// interface Error {}
6-
// interface Locals {}
7-
// interface PageData {}
8-
// interface PageState {}
9-
// interface Platform {}
10-
}
4+
namespace App {
5+
// interface Error {}
6+
// interface Locals {}
7+
// interface PageData {}
8+
// interface PageState {}
9+
// interface Platform {}
10+
}
1111
}
1212

1313
export {};

src/data-integrity.test.ts

Lines changed: 82 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -22,106 +22,106 @@ const news = JSON.parse(newsRaw) as Paper[];
2222
const courses = JSON.parse(courseRaw) as Course[];
2323

2424
test('Web names should be unique', () => {
25-
const webNames = new Set(papers.map((paper) => paper.web_name));
26-
expect(webNames.size).toBe(papers.length);
25+
const webNames = new Set(papers.map((paper) => paper.web_name));
26+
expect(webNames.size).toBe(papers.length);
2727
});
2828

2929
test('All papers should have corresponding venues', () => {
30-
const venuesSet = new Set(papers.map((paper) => paper.venue));
31-
const venues = featuredVenues.map((venue) => venue.venue_nickname);
32-
const missingVenues = venues.filter((venue) => !venuesSet.has(venue));
33-
expect(missingVenues).toEqual([]);
30+
const venuesSet = new Set(papers.map((paper) => paper.venue));
31+
const venues = featuredVenues.map((venue) => venue.venue_nickname);
32+
const missingVenues = venues.filter((venue) => !venuesSet.has(venue));
33+
expect(missingVenues).toEqual([]);
3434
});
3535

3636
test('All venue nicknames should be unique', () => {
37-
const venueNicknames = new Set(venues.map((venue) => venue.nickname));
38-
expect(venueNicknames.size).toBe(venues.length);
37+
const venueNicknames = new Set(venues.map((venue) => venue.nickname));
38+
expect(venueNicknames.size).toBe(venues.length);
3939
});
4040

4141
test('All papers should have corresponding people', () => {
42-
const peopleSet = new Set(people.map((person) => `${person.first_name} ${person.last_name}`));
43-
const paperAuthors = papers
44-
.flatMap((paper) => paper.authors.map((author) => `${author.first_name} ${author.last_name}`))
45-
.filter((author) => !peopleSet.has(author));
46-
expect(paperAuthors).toEqual([]);
42+
const peopleSet = new Set(people.map((person) => `${person.first_name} ${person.last_name}`));
43+
const paperAuthors = papers
44+
.flatMap((paper) => paper.authors.map((author) => `${author.first_name} ${author.last_name}`))
45+
.filter((author) => !peopleSet.has(author));
46+
expect(paperAuthors).toEqual([]);
4747
});
4848

4949
test('All papers should have urls for their authors if possible', () => {
50-
const authorUrls = Object.fromEntries(
51-
people
52-
.filter((person) => (person?.url || '').length)
53-
.map((person) => [`${person.first_name} ${person.last_name}`, person.url])
54-
);
55-
const updatedPapers = papers.map((paper) => {
56-
const authors = paper.authors.map((author) => {
57-
return {
58-
...author,
59-
url: authorUrls[`${author.first_name} ${author.last_name}`]
60-
};
61-
});
62-
return {
63-
...paper,
64-
authors
65-
};
66-
});
67-
expect(updatedPapers).toEqual(papers);
50+
const authorUrls = Object.fromEntries(
51+
people
52+
.filter((person) => (person?.url || '').length)
53+
.map((person) => [`${person.first_name} ${person.last_name}`, person.url])
54+
);
55+
const updatedPapers = papers.map((paper) => {
56+
const authors = paper.authors.map((author) => {
57+
return {
58+
...author,
59+
url: authorUrls[`${author.first_name} ${author.last_name}`]
60+
};
61+
});
62+
return {
63+
...paper,
64+
authors
65+
};
66+
});
67+
expect(updatedPapers).toEqual(papers);
6868
});
6969

7070
[
71-
{ key: 'Paper', dataset: papers, accessor: (paper: Paper): string => paper.web_name },
72-
{
73-
key: 'Person',
74-
dataset: people,
75-
accessor: (person: Person): string => `${person.first_name} ${person.last_name}`
76-
},
77-
{
78-
key: 'Spotlight',
79-
dataset: spotlight,
80-
accessor: (spotlight: Spotlight): string => spotlight.title
81-
},
82-
{
83-
key: 'FeaturedVenue',
84-
dataset: featuredVenues,
85-
accessor: (venue: FeaturedVenue): string => venue.desc
86-
},
87-
{
88-
key: 'News',
89-
dataset: news,
90-
accessor: (x: News): string => x.text
91-
},
92-
{
93-
key: 'Venue',
94-
dataset: venues,
95-
accessor: (venue: Venue): string => venue.nickname
96-
},
97-
{
98-
key: 'Course',
99-
dataset: courses as Course[],
100-
accessor: (course: Course): string => course.name
101-
}
71+
{ key: 'Paper', dataset: papers, accessor: (paper: Paper): string => paper.web_name },
72+
{
73+
key: 'Person',
74+
dataset: people,
75+
accessor: (person: Person): string => `${person.first_name} ${person.last_name}`
76+
},
77+
{
78+
key: 'Spotlight',
79+
dataset: spotlight,
80+
accessor: (spotlight: Spotlight): string => spotlight.title
81+
},
82+
{
83+
key: 'FeaturedVenue',
84+
dataset: featuredVenues,
85+
accessor: (venue: FeaturedVenue): string => venue.desc
86+
},
87+
{
88+
key: 'News',
89+
dataset: news,
90+
accessor: (x: News): string => x.text
91+
},
92+
{
93+
key: 'Venue',
94+
dataset: venues,
95+
accessor: (venue: Venue): string => venue.nickname
96+
},
97+
{
98+
key: 'Course',
99+
dataset: courses as Course[],
100+
accessor: (course: Course): string => course.name
101+
}
102102
].forEach(({ key, dataset, accessor }) => {
103-
test(`All ${key} values should be filled out`, () => {
104-
const ajv = new Ajv({ allErrors: true });
103+
test(`All ${key} values should be filled out`, () => {
104+
const ajv = new Ajv({ allErrors: true });
105105

106-
const config = {
107-
path: 'src/lib/app-types.ts',
108-
tsconfig: 'tsconfig.json',
109-
type: key,
110-
additionalProperties: false
111-
};
106+
const config = {
107+
path: 'src/lib/app-types.ts',
108+
tsconfig: 'tsconfig.json',
109+
type: key,
110+
additionalProperties: false
111+
};
112112

113-
const schema = tsj.createGenerator(config).createSchema(config.type);
113+
const schema = tsj.createGenerator(config).createSchema(config.type);
114114

115-
dataset.forEach((unit) => {
116-
const result = ajv.validate(schema, unit);
117-
if (!result) {
118-
console.log(ajv.errors);
119-
}
115+
dataset.forEach((unit) => {
116+
const result = ajv.validate(schema, unit);
117+
if (!result) {
118+
console.log(ajv.errors);
119+
}
120120

121-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
122-
// @ts-ignore
123-
const unitName = accessor(unit);
124-
expect(result, `${key}: "${unitName}" is invalid`).toBe(true);
125-
});
126-
});
121+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
122+
// @ts-ignore
123+
const unitName = accessor(unit);
124+
expect(result, `${key}: "${unitName}" is invalid`).toBe(true);
125+
});
126+
});
127127
});

0 commit comments

Comments
 (0)