Skip to content

Commit

Permalink
fixed headers and license check to use eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
iislucas committed Oct 26, 2024
1 parent 9bbadb6 commit 84f414d
Show file tree
Hide file tree
Showing 24 changed files with 337 additions and 96 deletions.
19 changes: 16 additions & 3 deletions .github/license-check/header-Apache-2.0.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
/**
* @license SPDX-License-Identifier: Apache-2.0
*/
/** Copyright 2024 Google LLC. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

@license SPDX-License-Identifier: Apache-2.0
============================================================================= */
19 changes: 0 additions & 19 deletions .github/license-check/license-config.json

This file was deleted.

8 changes: 1 addition & 7 deletions .github/workflows/dev_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,9 @@ jobs:
run: npm clean-install
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: npm audit signatures
- name: Check license headers
uses: viperproject/check-license-header@v2
with:
path: './'
config: './.github/license-check/license-config.json'
strict: true
- name: Check code style
run: npm run prettier:check
- name: Lint
- name: Lint & license header check
run: npm run lint
- name: Test
run: npm run test:ci
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/release_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,9 @@ jobs:
run: npm clean-install
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: npm audit signatures
- name: Check license headers
uses: viperproject/check-license-header@v2
with:
path: './'
config: './.github/license-check/license-config.json'
strict: true
- name: Check code style
run: npm run prettier:check
- name: Lint
- name: Lint & license header check
run: npm run lint
- name: Test
run: npm run test:ci
Expand Down
18 changes: 16 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,22 @@

import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import licenseHeader from "eslint-plugin-license-header";

export default tseslint.config(
const config = tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended
...tseslint.configs.recommended,
{
plugins: {
'license-header': licenseHeader
},
rules: {
'license-header/header': [
'error',
'./.github/license-check/header-Apache-2.0.txt'
]
}
}
);

export default config;
30 changes: 27 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"name": "ts-llmt",
"version": "0.0.1",
"version": "0.0.2",
"description": "Experimental TypeScript library for Large Language Model Templates",
"main": "index.js",
"scripts": {
"build": "tsc -p .",
"build:dry-run": "tsc --noEmit",
"check-licenses": "check-license-header check --config .github/license-check/license-config.json --strict",
"clean": "rimraf ./dist && mkdir dist",
"lint": "eslint ./src",
"prettier:check": "prettier --check '**/*.{js,ts}'",
Expand All @@ -15,7 +14,7 @@
"test:ci": "jest --testTimeout=15000",
"test:dev": "jest --watchAll --coverage",
"test:trace": "node --trace-warnings node_modules/.bin/jest --maxWorkers=1 --no-cache --verbose",
"premerge": "npm run check-licenses && npm run lint && npm run prettier:check && npm run build && npm run test:trace"
"premerge": "npm run lint && npm run prettier:check && npm run build && npm run test:trace"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -44,8 +43,8 @@
"@tsconfig/node18": "18.2.4",
"@types/jest": "29.5.12",
"@types/underscore": "1.11.15",
"check-license-header": "github:viperproject/check-license-header#v2",
"eslint": "8.57.0",
"eslint-plugin-license-header": "^0.6.1",
"google-auth-library": "^9.14.2",
"prettier": "3.2.5",
"rimraf": "5.0.7",
Expand Down
19 changes: 16 additions & 3 deletions src/fewshot_template.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
/**
* @license SPDX-License-Identifier: Apache-2.0
*/
/** Copyright 2024 Google LLC. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@license SPDX-License-Identifier: Apache-2.0
============================================================================= */

import { Template, template, nv, matchTemplate } from './template';
import { FewShotTemplate, matchFewShotTemplate } from './fewshot_template';
Expand Down
19 changes: 16 additions & 3 deletions src/fewshot_template.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
/**
* @license SPDX-License-Identifier: Apache-2.0
*/
/** Copyright 2024 Google LLC. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@license SPDX-License-Identifier: Apache-2.0
============================================================================= */

/*
A few shot template class. This allows separating the template from the list of
Expand Down
19 changes: 16 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
/**
* @license SPDX-License-Identifier: Apache-2.0
*/
/** Copyright 2024 Google LLC. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@license SPDX-License-Identifier: Apache-2.0
============================================================================= */

import {
template,
Expand Down
19 changes: 16 additions & 3 deletions src/llm.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
/**
* @license SPDX-License-Identifier: Apache-2.0
*/
/** Copyright 2024 Google LLC. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@license SPDX-License-Identifier: Apache-2.0
============================================================================= */

/*
Showing how the LLM class works...
Expand Down
19 changes: 16 additions & 3 deletions src/llm.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
/**
* @license SPDX-License-Identifier: Apache-2.0
*/
/** Copyright 2024 Google LLC. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@license SPDX-License-Identifier: Apache-2.0
============================================================================= */

/*
An class to wrap, and provide a common interface for LLM behaviour.
Expand Down
19 changes: 16 additions & 3 deletions src/llm_api.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
/**
* @license SPDX-License-Identifier: Apache-2.0
*/
/** Copyright 2024 Google LLC. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@license SPDX-License-Identifier: Apache-2.0
============================================================================= */

/*
An class to wrap, and provide a common interface for LLM behaviour.
Expand Down
19 changes: 16 additions & 3 deletions src/llm_vertexapi_gemini_1_5_authtoken.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
/**
* @license SPDX-License-Identifier: Apache-2.0
*/
/** Copyright 2024 Google LLC. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@license SPDX-License-Identifier: Apache-2.0
============================================================================= */

/*
A minimal Google Cloud Vertex Gemini API, using an accessToken for auth.
Expand Down
Loading

0 comments on commit 84f414d

Please sign in to comment.