Skip to content

Commit

Permalink
Release v1.2.2 (#44)
Browse files Browse the repository at this point in the history
- dep(eslint): update to v9 & config
- chore: remove deprecated eslint rules
- chore: tighten up fromBind regex
- chore: use package.json[files], delete .npmignore
- doc(CONTRIBUTORS): added
- packaging tweaks (#43)
  • Loading branch information
msimerson authored Nov 17, 2024
1 parent 0dbed54 commit a0f1cc7
Show file tree
Hide file tree
Showing 13 changed files with 89 additions and 66 deletions.
28 changes: 0 additions & 28 deletions .eslintrc.yaml

This file was deleted.

16 changes: 0 additions & 16 deletions .npmignore

This file was deleted.

2 changes: 1 addition & 1 deletion .release
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Notable changes to this project are documented in this file.

#### Unreleased

### [1.2.2] - 2024-11-17

- dep(eslint): update to v9 & config
- chore: tighten up fromBind regex
- packaging tweaks (#43)

### [1.2.1] - 2024-03-10

- fix(nsec3param): fixed setHash fname typo
Expand Down Expand Up @@ -295,3 +301,6 @@ Notable changes to this project are documented in this file.
[1.1.6]: https://github.com/NicTool/dns-resource-record/releases/tag/1.1.6
[1.1.8]: https://github.com/NicTool/dns-resource-record/releases/tag/1.1.8
[1.2.1]: https://github.com/NicTool/dns-resource-record/releases/tag/1.2.1
[1.2.2]: https://github.com/NicTool/dns-resource-record/releases/tag/v1.2.2
[1.1.7]: https://github.com/NicTool/dns-resource-record/releases/tag/1.1.7
[1.2.0]: https://github.com/NicTool/dns-resource-record/releases/tag/1.2.0
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This module is used to:
| **MaraDNS** | | :white_check_mark: |
| **JS** | :white_check_mark: | :white_check_mark: |

This package intends to import and export RFC compliant DNS resource records. Please [raise an issue](https://github.com/NicTool/dns-resource-record/issues) if you a valid resource record fails to pass or an invalid resource record passes.
This package intends to import and export RFC compliant DNS resource records. Please [raise an issue](https://github.com/NicTool/dns-resource-record/issues) if a valid resource record fails to pass or an invalid resource record passes.

This package is for working with _individual_ Resource Records. For working with zones of RRs, use [dns-zone](https://github.com/NicTool/dns-zone).

Expand Down Expand Up @@ -239,6 +239,8 @@ PRs are welcome, especially PRs with tests.

- [Dictionary of DNS terms](https://nictool.github.io/web/Dictionary)
- [Wikipedia, List of DNS Record Types](https://en.wikipedia.org/wiki/List_of_DNS_record_types)
- @nictool/[dns-zone](https://www.npmjs.com/package/@nictool/dns-zone)
- @nictool/[dns-nameserver](https://www.npmjs.com/package/@nictool/dns-nameserver)

## TODO

Expand Down
41 changes: 41 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import globals from 'globals'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import js from '@eslint/js'
import { FlatCompat } from '@eslint/eslintrc'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
})

export default [
{
languageOptions: {
ecmaVersion: 'latest',
globals: {
...globals.node,
...globals.browser,
...globals.mocha,
},
sourceType: 'module',
},

rules: {
// 'no-undef': [ 'warn' ],
'no-unused-vars': [
'error',
{
args: 'none',
},
],

'dot-notation': 'error',
'prefer-const': 'warn',
},
},
js.configs.recommended,
]
15 changes: 12 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
{
"name": "@nictool/dns-resource-record",
"version": "1.2.1",
"version": "1.2.2",
"description": "DNS Resource Records",
"main": "index.js",
"file": [
"lib",
"rr",
"CHANGELOG.md",
"rr.js"
],
"type": "module",
"scripts": {
"format:check": "npm run prettier; npm run lint",
"format": "npm run prettier -- --write && npm run lint --fix",
"lint": "npx eslint **/*.js",
"lint": "npx eslint@9 **/*.js",
"lint:fix": "npm run lint -- --fix",
"prettier": "npx prettier --ignore-path .gitignore --check .",
"prettier:fix": "npx prettier --ignore-path .gitignore --write .",
Expand Down Expand Up @@ -39,6 +45,9 @@
},
"homepage": "https://github.com/NicTool/dns-resource-record#readme",
"devDependencies": {
"mocha": "^10.3.0"
"@eslint/js": "^9.15.0",
"eslint": "^9.15.0",
"globals": "^15.12.0",
"mocha": "^10.8.2"
}
}
8 changes: 5 additions & 3 deletions rr/caa.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,11 @@ export default class CAA extends RR {

fromBind(opts) {
// test.example.com 3600 IN CAA flags, tags, value
const fields = opts.bindline.match(
/^([^\s]+)\s+([0-9]+)\s+(\w+)\s+(\w+)\s+([0-9]+)\s+(\w+)\s+("[^"]+"|[^\s]+?)\s*$/i,
)
const fields = opts.bindline
.trim()
.match(
/^([\S]+)\s+([0-9]{1,10})\s+(IN)\s+(CAA)\s+([0-9]+)\s+(\w+)\s+("[^"]+"|[\S]+?)$/i,
)
if (!fields) this.throwHelp(`unable to parse: ${opts.bindline}`)

const [owner, ttl, c, type, flags, tag, value] = fields.slice(1)
Expand Down
8 changes: 5 additions & 3 deletions rr/hinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ export default class HINFO extends RR {
/****** IMPORTERS *******/
fromBind(opts) {
// test.example.com 3600 IN HINFO DEC-2060 TOPS20
const match = opts.bindline.match(
/([^\s]+)\s+([0-9]+)\s+(IN)\s+(HINFO)\s+("[^"]+"|[^\s]+)\s+("[^"]+"|[^\s]+)/i,
)
const match = opts.bindline
.trim()
.match(
/^([\S]+)\s+([0-9]{1,10})\s+(IN)\s+(HINFO)\s+("[^"]+"|[\S]+)\s+("[^"]+"|[\S]+)/i,
)
if (!match) this.throwHelp(`unable to parse HINFO: ${opts.bindline}`)
const [owner, ttl, c, type, cpu, os] = match.slice(1)

Expand Down
6 changes: 3 additions & 3 deletions rr/openpgpkey.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export default class OPENPGPKEY extends RR {
fromBind(obj) {
// test.example.com 3600 IN OPENPGPKEY <base64 public key>
// eslint-disable-next-line no-unused-vars
const [ignore, owner, ttl, c, type, publickey] = obj.bindline.match(
/^([\S]+)\s+(\d+)\s+(\w+)\s+(\w+)\s+([\W\w]*)$/,
)
const [ignore, owner, ttl, c, type, publickey] = obj.bindline
.trim()
.match(/^([\S]+)\s+(\d{1,10})\s+(IN)\s+(OPENPGPKEY)\s+([\W\w]*)$/)

return new OPENPGPKEY({
owner,
Expand Down
8 changes: 5 additions & 3 deletions rr/tlsa.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ export default class TLSA extends RR {

fromBind(opts) {
// test.example.com 3600 IN TLSA, usage, selector, match, data
const match = opts.bindline.split(
/^([^\s]+)\s+([0-9]+)\s+(\w+)\s+(\w+)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+(.*?)\s*$/,
)
const match = opts.bindline
.trim()
.split(
/^([^\s]+)\s+([0-9]{1,10})\s+(IN)\s+(TLSA)\s+([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+(.*?)$/,
)
if (!match) this.throwHelp(`unable to parse TLSA: ${opts.bindline}`)
const [owner, ttl, c, type, usage, selector, matchtype, cad] =
match.slice(1)
Expand Down
6 changes: 3 additions & 3 deletions rr/txt.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ export default class TXT extends RR {

fromBind(opts) {
// test.example.com 3600 IN TXT "..."
const match = opts.bindline.split(
/^([^\s]+)\s+([0-9]+)\s+(\w+)\s+(\w+)\s+?\s*(.*?)\s*$/,
)
const match = opts.bindline
.trim()
.split(/^([\S]{1,255})\s+([0-9]{1,10})\s+(IN)\s+(\w{3})\s+?\s*(.*?)$/i)
if (!match) this.throwHelp(`unable to parse TXT: ${opts.bindline}`)
const [owner, ttl, c, type, rdata] = match.slice(1)

Expand Down
4 changes: 2 additions & 2 deletions test/rr.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import RR from '../rr.js'
import A from '../rr/a.js'

const cases = [
// { name: 'RR class' , obj: RR , expect: [ 'owner', 'ttl', 'class', 'type' ] },
// { name: 'RR class', obj: RR, expect: [ 'owner', 'ttl', 'class', 'type' ] },
{
name: 'RR instance',
obj: new RR(null),
expect: ['owner', 'ttl', 'class', 'type'],
},
// { name: 'A class' , obj: A , expect: [ 'owner', 'ttl', 'class', 'type', 'address' ] },
// { name: 'A class', obj: A, expect: [ 'owner', 'ttl', 'class', 'type', 'address' ] },
{
name: 'A instance',
obj: new A(null),
Expand Down

0 comments on commit a0f1cc7

Please sign in to comment.