Skip to content

Commit

Permalink
Add json type assertions for node 17.
Browse files Browse the repository at this point in the history
  • Loading branch information
maxerickson committed Jan 5, 2022
1 parent 84a2fed commit f4a1170
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions lib/file_tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import { sortObject } from './sort_object.js';
import { validate } from './validate.js';

// JSON
import treesJSON from '../config/trees.json';
const trees = treesJSON.trees;
import categoriesSchemaJSON from '../schema/categories.json';
import treesJSON from '../config/trees.json' assert {type: "json"};
const trees = treesJSON.trees

This comment has been minimized.

Copy link
@LaoshuBaby

LaoshuBaby Jan 6, 2022

Collaborator

Maybe you miss a ;

import categoriesSchemaJSON from '../schema/categories.json' assert {type: "json"};


// The code in here
Expand Down
6 changes: 3 additions & 3 deletions lib/matcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import whichPolygon from 'which-polygon';
import { simplify } from './simplify.js';

// JSON
import matchGroupsJSON from '../config/matchGroups.json';
import genericWordsJSON from '../config/genericWords.json';
import treesJSON from '../config/trees.json';
import matchGroupsJSON from '../config/matchGroups.json' assert {type: "json"};
import genericWordsJSON from '../config/genericWords.json' assert {type: "json"};
import treesJSON from '../config/trees.json' assert {type: "json"};

const matchGroups = matchGroupsJSON.matchGroups;
const trees = treesJSON.trees;
Expand Down
2 changes: 1 addition & 1 deletion lib/write_file_with_meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fs from 'node:fs';
import JSON5 from 'json5';

// JSON
import packageJSON from '../package.json';
import packageJSON from '../package.json' assert {type: "json"};

const URLRoot = 'https://raw.githubusercontent.com/osmlab/name-suggestion-index/main';

Expand Down
4 changes: 2 additions & 2 deletions scripts/build_features.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import stringify from '@aitodotai/json-stringify-pretty-compact';
import { writeFileWithMeta } from '../lib/write_file_with_meta.js';

// JSON
import geojsonSchemaJSON from '../schema/geojson.json';
import featureSchemaJSON from '../schema/feature.json';
import geojsonSchemaJSON from '../schema/geojson.json' assert {type: "json"};
import featureSchemaJSON from '../schema/feature.json' assert {type: "json"};

const Validator = jsonschema.Validator;
let v = new Validator();
Expand Down
4 changes: 2 additions & 2 deletions scripts/build_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import { writeFileWithMeta } from '../lib/write_file_with_meta.js';
const matcher = new Matcher();

// JSON
import treesJSON from '../config/trees.json';
import treesJSON from '../config/trees.json' assert {type: "json"};
const trees = treesJSON.trees;

// We use LocationConflation for validating and processing the locationSets
import featureCollectionJSON from '../dist/featureCollection.json';
import featureCollectionJSON from '../dist/featureCollection.json' assert {type: "json"};
const loco = new LocationConflation(featureCollectionJSON);

console.log(colors.blue('-'.repeat(70)));
Expand Down

0 comments on commit f4a1170

Please sign in to comment.