eslint-plugin-lube 0.1.3
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/README.md +5 -0
- package/index.js +1 -0
- package/package.json +27 -0
- package/private.d.ts +22 -0
- package/rules/svelte-naming-convention.js +398 -0
- package/test/svelte-naming-convention/basic_snake_case.js +34 -0
- package/test/svelte-naming-convention/case_by_identifier.js +1365 -0
- package/test/svelte-naming-convention/snake_case_with_symbols.js +58 -0
- package/test/svelte-naming-convention.js +20 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const error = {
|
|
2
|
+
messageId: "not_match",
|
|
3
|
+
type: "Identifier"
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* @param {import("eslint").RuleTester.ValidTestCase[]} valid
|
|
7
|
+
* @param {import("eslint").RuleTester.InvalidTestCase[]} invalid
|
|
8
|
+
*/
|
|
9
|
+
exports.module = (valid, invalid) => {
|
|
10
|
+
valid.push(
|
|
11
|
+
{ code: "var _ = 'Hello'" },
|
|
12
|
+
{ code: "var __ = 'Hello'" },
|
|
13
|
+
{ code: "var _snake_case = 'Hello'" },
|
|
14
|
+
{ code: "var $ = 'Hello'" },
|
|
15
|
+
{ code: "var $$ = 'Hello'" },
|
|
16
|
+
{ code: "var $snake_case$ = 'Hello'" },
|
|
17
|
+
{ code: "var __snake_case$$ = 'Hello'" },
|
|
18
|
+
{ code: "var $$snake_case$$ = 'Hello'" },
|
|
19
|
+
)
|
|
20
|
+
invalid.push(
|
|
21
|
+
{
|
|
22
|
+
code: "var __camelCase$$ = 'Hello'",
|
|
23
|
+
errors: [{
|
|
24
|
+
...error,
|
|
25
|
+
line: 1,
|
|
26
|
+
column: 5
|
|
27
|
+
}],
|
|
28
|
+
output: "var __camel_case$$ = 'Hello'"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
code: "var ___ = 'Hello'",
|
|
32
|
+
errors: [{
|
|
33
|
+
...error,
|
|
34
|
+
line: 1,
|
|
35
|
+
column: 5
|
|
36
|
+
}],
|
|
37
|
+
output: "var ___ = 'Hello'"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
code: "var $$$ = 'Hello'",
|
|
41
|
+
errors: [{
|
|
42
|
+
...error,
|
|
43
|
+
line: 1,
|
|
44
|
+
column: 5
|
|
45
|
+
}],
|
|
46
|
+
output: "var $$$ = 'Hello'"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
code: "var $snake$case$ = 'Hello'",
|
|
50
|
+
errors: [{
|
|
51
|
+
...error,
|
|
52
|
+
line: 1,
|
|
53
|
+
column: 5
|
|
54
|
+
}],
|
|
55
|
+
output: "var $snake$case$ = 'Hello'"
|
|
56
|
+
},
|
|
57
|
+
)
|
|
58
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict"
|
|
2
|
+
const { RuleTester } = require("eslint")
|
|
3
|
+
|
|
4
|
+
/** @type {RuleTester.ValidTestCase[]} */
|
|
5
|
+
const valid = []
|
|
6
|
+
/** @type {RuleTester.InvalidTestCase[]} */
|
|
7
|
+
const invalid = []
|
|
8
|
+
|
|
9
|
+
require("./svelte-naming-convention/basic_snake_case").module(valid, invalid)
|
|
10
|
+
require("./svelte-naming-convention/case_by_identifier").module(valid, invalid)
|
|
11
|
+
require("./svelte-naming-convention/snake_case_with_symbols").module(valid, invalid)
|
|
12
|
+
|
|
13
|
+
new RuleTester().run(
|
|
14
|
+
"svelte-naming-convention",
|
|
15
|
+
require("../rules/svelte-naming-convention"),
|
|
16
|
+
{
|
|
17
|
+
valid,
|
|
18
|
+
invalid
|
|
19
|
+
}
|
|
20
|
+
)
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"allowJs": true,
|
|
4
|
+
"allowSyntheticDefaultImports": true,
|
|
5
|
+
"checkJs": true,
|
|
6
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
7
|
+
"module": "CommonJS",
|
|
8
|
+
"outDir": "silences wrong TS error, we don't compile, we only typecheck",
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"strict": true,
|
|
11
|
+
"target": "ESNext"
|
|
12
|
+
}
|
|
13
|
+
}
|