Skip to content

Commit

Permalink
Migrate to TypeScript and update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
rasshofer committed Apr 22, 2022
1 parent 5d6c0a8 commit 33c884f
Show file tree
Hide file tree
Showing 25 changed files with 10,889 additions and 3,445 deletions.
12 changes: 0 additions & 12 deletions .editorconfig

This file was deleted.

1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.d.ts
31 changes: 31 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
env:
es6: true
node: true
jest: true
extends:
- airbnb-base
- prettier
- plugin:@typescript-eslint/recommended
parser: '@typescript-eslint/parser'
plugins:
- '@typescript-eslint'
- prettier
settings:
import/resolver:
node:
extensions:
- '.js'
- '.ts'
overrides:
- files:
- '**/*.test.ts'
rules:
'import/no-extraneous-dependencies': 0
'import/first': 0
'import/order': 0
rules:
max-len: 0
no-mixed-operators: 0
prettier/prettier: error
import/extensions: 0
13 changes: 0 additions & 13 deletions .eslintrc.yml

This file was deleted.

42 changes: 42 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build

on:
push:
branches:
- 'master'

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '16'

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ hashFiles('**/package-lock.json') }}

- name: Install
run: npm ci --no-optional

- name: Lint
run: npm run lint

- name: Build
run: npm run build

- name: Test
run: npm test

- name: Coveralls
uses: coverallsapp/github-action@v1.1.0
with:
github-token: ${{ secrets.github_token }}
62 changes: 2 additions & 60 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,61 +1,3 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
node_modules
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next
dist
11 changes: 11 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules
coverage
.prettierrc
.nvmrc
.github
src
jest.config.js
.eslintignore
.eslintrc.yaml
tsconfig.json
__tests__
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "all"
}
7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2018 Thomas Rasshofer <hello@thomasrasshofer.com>
Copyright (c) 2022 Thomas Rasshofer <hello@thomasrasshofer.com>

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
99 changes: 48 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,34 @@

> A simple (CLI) tool to lint YAML files
[![Build Status](https://img.shields.io/travis/rasshofer/yaml-lint.svg?style=flat-square)](https://travis-ci.org/rasshofer/yaml-lint)
[![Dependency Status](https://img.shields.io/david/rasshofer/yaml-lint.svg?style=flat-square)](https://david-dm.org/rasshofer/yaml-lint)
[![Dev Dependency Status](https://img.shields.io/david/dev/rasshofer/yaml-lint.svg?style=flat-square)](https://david-dm.org/rasshofer/yaml-lint)
[![Version](https://img.shields.io/npm/v/yaml-lint.svg?style=flat-square)](https://www.npmjs.com/package/yaml-lint)
[![Month Download](https://img.shields.io/npm/dm/yaml-lint.svg?style=flat-square)](https://www.npmjs.com/package/yaml-lint)
[![License](https://img.shields.io/npm/l/yaml-lint.svg?style=flat-square)](https://www.npmjs.com/package/yaml-lint)
[![Coverage Status](https://coveralls.io/repos/github/rasshofer/yaml-lint/badge.svg?branch=master)](https://coveralls.io/github/rasshofer/yaml-lint?branch=master)

## Usage

```shell
```sh
npm install --save-dev yaml-lint
```

```js
const yamlLint = require('yaml-lint');

yamlLint.lint('test: 123').then(() => {
console.log('Valid YAML file.');
}).catch((error) => {
console.error('Invalid YAML file.', error);
});
yamlLint
.lint('test: 123')
.then(() => {
console.log('Valid YAML file.');
})
.catch((error) => {
console.error('Invalid YAML file.', error);
});
```

## CLI

```shell
```sh
npm install -g yaml-lint
```

```shell
```sh
yamllint test.yaml
```

Expand All @@ -50,13 +48,13 @@ First of all, YAML Lint looks for a JSON file called `.yaml-lint.json` within th

Afterwards, YAML Lint will take environment variables into account.

```shell
```sh
YAMLLINT_SCHEMA=CORE_SCHEMA YAMLLINT_IGNORE=dir/*.yaml yamllint
```

Concluding, YAML Lint will take command-line arguments into account.

```shell
```sh
yamllint --schema=CORE_SCHEMA --ignore=dir/*.yaml
```

Expand All @@ -66,54 +64,53 @@ yamllint --schema=CORE_SCHEMA --ignore=dir/*.yaml

> Specifies a schema to use
- `DEFAULT_FULL_SCHEMA` All supported YAML types (default)
- `FAILSAFE_SCHEMA` Only strings, arrays, and plain objects ([http://www.yaml.org/spec/1.2/spec.html#id2802346](http://www.yaml.org/spec/1.2/spec.html#id2802346))
- `JSON_SCHEMA` All JSON-supported types ([http://www.yaml.org/spec/1.2/spec.html#id2803231](http://www.yaml.org/spec/1.2/spec.html#id2803231))
- `CORE_SCHEMA` Same as `JSON_SCHEMA` ([http://www.yaml.org/spec/1.2/spec.html#id2804923](http://www.yaml.org/spec/1.2/spec.html#id2804923))
- `DEFAULT_SAFE_SCHEMA` All supported YAML types, without unsafe ones (`!!js/undefined`, `!!js/regexp`, and `!!js/function`) ([http://yaml.org/type/](http://yaml.org/type/))
- `DEFAULT_SCHEMA` All supported YAML types
- `FAILSAFE_SCHEMA` Only strings, arrays, and plain objects (<http://www.yaml.org/spec/1.2/spec.html#id2802346>)
- `JSON_SCHEMA` All JSON-supported types (<http://www.yaml.org/spec/1.2/spec.html#id2803231>)
- `CORE_SCHEMA` Same as `JSON_SCHEMA` (<http://www.yaml.org/spec/1.2/spec.html#id2804923>)

### `ignore` (string or array of strings)

> Specifies one or multiple glob patterns to ignore
```shell
```sh
yamllint **/*.(yaml|yml) --ignore=foobar.yml --ignore=dir/*.yaml
```

## Changelog

* 1.2.4
* Fix paths for ignored patterns
* 1.2.3
* Remove `nocase` rule to prevent problems on Windows
* 1.2.2
* Fix CLI support relative paths
* 1.2.1
* Fix README
* 1.2.0
* Add documentation regarding how to specify options
* Update dependencies
* Support ignoring specific files
* 1.1.0
* Update dependencies
* Migrate syntax to ES2015+
* 1.0.0
* Update dependencies
* Enable tests for Node.js 8
* Remove support for Node.js 0.x
* 0.0.4
* Print file names when logging YAML errors while using the CLI
* 0.0.3
* Implement check for empty file selections while using the CLI
* 0.0.2
* Prettier error messages within CLI
* Add shebang for CLI
* 0.0.1
* Initial version
- 1.2.4
- Fix paths for ignored patterns
- 1.2.3
- Remove `nocase` rule to prevent problems on Windows
- 1.2.2
- Fix CLI support relative paths
- 1.2.1
- Fix README
- 1.2.0
- Add documentation regarding how to specify options
- Update dependencies
- Support ignoring specific files
- 1.1.0
- Update dependencies
- Migrate syntax to ES2015+
- 1.0.0
- Update dependencies
- Enable tests for Node.js 8
- Remove support for Node.js 0.x
- 0.0.4
- Print file names when logging YAML errors while using the CLI
- 0.0.3
- Implement check for empty file selections while using the CLI
- 0.0.2
- Prettier error messages within CLI
- Add shebang for CLI
- 0.0.1
- Initial version

## License

Copyright (c) 2018 [Thomas Rasshofer](http://thomasrasshofer.com/)
Copyright (c) 2022 [Thomas Rasshofer](https://thomasrasshofer.com/)
Licensed under the MIT license.

See LICENSE for more info.
Expand Down

0 comments on commit 33c884f

Please sign in to comment.