Skip to content

Commit

Permalink
Fix lint issues and add type check (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
whscullin authored Jan 8, 2025
1 parent e6e6a3d commit b7721a0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"node": ">=10"
},
"scripts": {
"lint": "gts lint",
"lint": "tsc --noEmit && gts lint",
"test": "NODE_ENV=test jest --projects jest.config.js --runInBand",
"test-silent": "NODE_ENV=test JEST_SILENT_REPORTER_SHOW_PATHS=true jest --projects jest.config.js --runInBand --reporters jest-silent-reporter",
"test-e2e": "npm run package-npm test > /dev/null 2>&1 && ts-node test/.build/npmBin/post-install.js > /dev/null 2>&1 && NODE_ENV=test jest --projects=jest-e2e.config.js --runInBand",
Expand Down
20 changes: 10 additions & 10 deletions scripts/third-party-licenses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,17 @@ import fs from 'fs';
import {stringify} from 'csv-stringify';
import {readPackageJson} from './utils/licenses';
import path from 'path';
import {errorMessage} from '../src/util';

interface OutputRow {
name: string;
url?: string;
licenseLink: string;
licenseName: string;
binaryName: string;
copyrightIncluded: string;
sourceCodeIncluded: string;
hasNoticeFile: string;
licenseLink?: string;
licenseName?: string;
binaryName?: string;
copyrightIncluded?: string;
sourceCodeIncluded?: string;
hasNoticeFile?: string;
}

const outputFile = process.argv[2];
Expand All @@ -59,8 +60,6 @@ if (fs.existsSync(outputFile)) throw new Error('Output file exists already');
axios.defaults.timeout = 500000;
axios.defaults.httpsAgent = new https.Agent({keepAlive: true});

const malloyPackages = ['@malloydata/malloy-cli'];

// licenses that we would need to mirror source for, if we included (we don't today)
const sourceMirrorLicenses = [
'CDDL-1.0',
Expand Down Expand Up @@ -120,7 +119,7 @@ const getLicenses = async () => {
).builtIntoPackageDependencies;

const seen: string[] = [];
const dependenciesForPackage = (pkg: string): Partial<OutputRow>[] => {
const dependenciesForPackage = (pkg: string): OutputRow[] => {
if (!seen.find(a => a === pkg)) {
seen.push(pkg);
console.log(`npm view ${pkg} dependencies repository.url license --json`);
Expand Down Expand Up @@ -151,11 +150,12 @@ const getLicenses = async () => {
const dependencies = dependenciesInPackage
.map(dep => dependenciesForPackage(dep))
.flat()
.filter(a => a.name)
.sort((a, b) => a.name.localeCompare(b.name));

for (const dependency of dependencies) {
const name = dependency.name;
const row: Partial<OutputRow> = dependency;
const row: OutputRow = dependency;
const url = dependency.url;

if (Object.keys(licenseFoundElsewhere).includes(name)) {
Expand Down
2 changes: 0 additions & 2 deletions test/malloy/malloy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

import {createCLI} from '../../src/cli';
import {loadConfig} from '../../src/config';
import {loadConnections} from '../../src/connections/connection_manager';
import {createBasicLogger, silenceOut} from '../../src/log';

describe('Malloy', () => {
beforeAll(() => {
const cli = createCLI();
// call 'preAction' hooks
// so that things like logger, connectionManager are created
createBasicLogger();
Expand Down
2 changes: 0 additions & 2 deletions test/malloy/malloysql.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*/

import path from 'path';
import {createCLI} from '../../src/cli';
import {runMalloySQL} from '../../src/malloy/malloySQL';
import {createBasicLogger, silenceOut} from '../../src/log';
import {QueryOptionsType} from '../../src/malloy/util';
Expand All @@ -40,7 +39,6 @@ const complex1 = path.join(

describe('MalloySQL', () => {
beforeAll(() => {
const cli = createCLI();
// call 'preAction' hooks
// so that things like logger, connectionManager are created
createBasicLogger();
Expand Down

0 comments on commit b7721a0

Please sign in to comment.