@sqldoc/ns-lint 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +30 -0
- package/src/__tests__/lint.test.ts +31 -0
- package/src/index.ts +15 -0
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "module",
|
|
3
|
+
"name": "@sqldoc/ns-lint",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"description": "Lint namespace for sqldoc -- @lint.ignore tag for suppressing lint rules",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./src/index.ts",
|
|
9
|
+
"import": "./src/index.ts",
|
|
10
|
+
"default": "./src/index.ts"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"main": "./src/index.ts",
|
|
14
|
+
"types": "./src/index.ts",
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"package.json"
|
|
18
|
+
],
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"@sqldoc/core": "0.0.1"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"typescript": "^5.9.3",
|
|
24
|
+
"vitest": "^4.1.0",
|
|
25
|
+
"@sqldoc/core": "0.0.1"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"test": "vitest run"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import plugin from '../index'
|
|
3
|
+
|
|
4
|
+
describe('ns-lint plugin', () => {
|
|
5
|
+
it('exports apiVersion === 1', () => {
|
|
6
|
+
expect(plugin.apiVersion).toBe(1)
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
it('exports name === "lint"', () => {
|
|
10
|
+
expect(plugin.name).toBe('lint')
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
it('has an ignore tag definition', () => {
|
|
14
|
+
expect(plugin.tags).toHaveProperty('ignore')
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('ignore tag targets tables, columns, views, and functions', () => {
|
|
18
|
+
expect(plugin.tags.ignore.targets).toEqual(['table', 'column', 'view', 'function'])
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
it('ignore tag takes two positional string args', () => {
|
|
22
|
+
const args = plugin.tags.ignore.args as Array<{ type: string }>
|
|
23
|
+
expect(args).toHaveLength(2)
|
|
24
|
+
expect(args[0].type).toBe('string')
|
|
25
|
+
expect(args[1].type).toBe('string')
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
it('does not produce SQL output (no onTag)', () => {
|
|
29
|
+
expect(plugin.onTag).toBeUndefined()
|
|
30
|
+
})
|
|
31
|
+
})
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { NamespacePlugin } from '@sqldoc/core'
|
|
2
|
+
|
|
3
|
+
const plugin: NamespacePlugin = {
|
|
4
|
+
apiVersion: 1,
|
|
5
|
+
name: 'lint',
|
|
6
|
+
tags: {
|
|
7
|
+
ignore: {
|
|
8
|
+
description: 'Suppress a lint rule on this object. Reason is mandatory.',
|
|
9
|
+
targets: ['table', 'column', 'view', 'function'],
|
|
10
|
+
args: [{ type: 'string' }, { type: 'string' }],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default plugin
|