Skip to content

Commit

Permalink
feat: convert to typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
madbence committed Oct 18, 2020
1 parent a42390e commit ea36a87
Show file tree
Hide file tree
Showing 45 changed files with 439 additions and 245 deletions.
18 changes: 10 additions & 8 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
plugins:
- '@typescript-eslint'

parser: '@typescript-eslint/parser'

parserOptions:
sourceType: module

env:
commonjs: true
es6: true
node: true
extends: 'eslint:recommended'
globals:
Atomics: readonly
SharedArrayBuffer: readonly
parserOptions:
ecmaVersion: 2018

overrides:
- files:
- 'regression-tests/*.js'
env:
jest: true
rules:

rules:
# possible errors
for-direction: error
getter-return: error
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_modules
.vscode/
regression-tests/test.log
coverage
lib
182 changes: 182 additions & 0 deletions package-lock.json

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

29 changes: 11 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,25 @@
{
"name": "tekton-lint",
"files": [
"utils.js",
"watch.js",
"lint.js",
"reporter.js",
"rules.js",
"collect-resources.js",
"Collector.js",
"runner.js",
"rules/*.js",
"rule-loader.js",
"walk.js",
".tektonlintrc.yaml",
"log-problems.js",
"formatters/*.js"
"lib/**/*.js",
"lib/**/*.d.ts",
".tektonlintrc.yaml"
],
"scripts": {
"lint": "eslint './*.js' './rules/*.js' './regression-tests/*.js'",
"lint": "eslint --ext ts src",
"test": "jest",
"build": "tsc",
"coverage": "jest --coverage"
},
"version": "0.4.4",
"description": "Linter for Tekton definitions",
"main": "runner.js",
"main": "lib/runner.js",
"repository": {
"type": "git",
"url": "git@github.com:IBM/tekton-lint.git"
},
"bin": {
"tekton-lint": "lint.js"
"tekton-lint": "lib/lint.js"
},
"author": "Bence Dányi <bence.danyi@ibm.com>",
"license": "Apache-2.0",
Expand All @@ -46,9 +36,12 @@
"devDependencies": {
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@typescript-eslint/eslint-plugin": "^4.4.0",
"@typescript-eslint/parser": "^4.4.0",
"eslint": "^6.8.0",
"husky": "^4.2.3",
"jest": "^26.0.1"
"jest": "^26.0.1",
"typescript": "^4.0.3"
},
"engines": {
"node": ">= 12.0.0"
Expand Down
2 changes: 1 addition & 1 deletion readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ interface Problem {
##### Example

```js
const linter = require('tekton-lint/runner');
const linter = require('tekton-lint');

const problems = await linter(['path/to/defs/**/*.yaml']);

Expand Down
6 changes: 3 additions & 3 deletions regression-tests/regresion.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const collect = require('../Collector');
const runner = require('../runner');
const collect = require('../lib/Collector').default;
const { default: runner, lint } = require('../lib/runner');

it('regression tests with location', async () => {
const result = await runner(['./regression-tests/*.yaml']);
Expand All @@ -19,6 +19,6 @@ it('regression tests with location', async () => {
it('regression tests without location', async () => {
const reference = await runner(['./regression-tests/*.yaml']);
const docs = await collect(['./regression-tests/*.yaml']);
const result = await runner.lint(docs.map(d => d.content));
const result = await lint(docs.map(d => d.content));
expect(result).toHaveLength(reference.length);
});
Loading

0 comments on commit ea36a87

Please sign in to comment.