@dataport/eslint-config-geodev 0.4.1 → 1.0.0-alpha.2

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.
Files changed (53) hide show
  1. package/LICENSE +287 -21
  2. package/dist/configs/browser.d.ts +7 -0
  3. package/dist/configs/browser.js +15 -0
  4. package/dist/configs/browser.js.map +1 -0
  5. package/dist/configs/html.d.ts +5 -0
  6. package/dist/configs/html.js +11 -0
  7. package/dist/configs/html.js.map +1 -0
  8. package/dist/configs/index.d.ts +5 -0
  9. package/dist/configs/index.js +21 -0
  10. package/dist/configs/index.js.map +1 -0
  11. package/dist/configs/json.d.ts +5 -0
  12. package/dist/configs/json.js +19 -0
  13. package/dist/configs/json.js.map +1 -0
  14. package/dist/configs/markdown.d.ts +5 -0
  15. package/dist/configs/markdown.js +16 -0
  16. package/dist/configs/markdown.js.map +1 -0
  17. package/dist/configs/node.d.ts +7 -0
  18. package/dist/configs/node.js +18 -0
  19. package/dist/configs/node.js.map +1 -0
  20. package/dist/configs/typescript.d.ts +5 -0
  21. package/dist/configs/typescript.js +36 -0
  22. package/dist/configs/typescript.js.map +1 -0
  23. package/dist/configs/vue-pug.d.ts +5 -0
  24. package/dist/configs/vue-pug.js +9 -0
  25. package/dist/configs/vue-pug.js.map +1 -0
  26. package/dist/configs/vue.d.ts +5 -0
  27. package/dist/configs/vue.js +20 -0
  28. package/dist/configs/vue.js.map +1 -0
  29. package/dist/configs/vue2.d.ts +5 -0
  30. package/dist/configs/vue2.js +12 -0
  31. package/dist/configs/vue2.js.map +1 -0
  32. package/dist/rules/index.d.ts +23 -0
  33. package/dist/rules/index.js +7 -0
  34. package/dist/rules/index.js.map +1 -0
  35. package/dist/rules/json-indent.d.ts +19 -0
  36. package/dist/rules/json-indent.js +142 -0
  37. package/dist/rules/json-indent.js.map +1 -0
  38. package/package.json +36 -18
  39. package/.editorconfig +0 -4
  40. package/.github/workflows/publish-to-npm.yaml +0 -21
  41. package/configs/browser.js +0 -11
  42. package/configs/html.js +0 -10
  43. package/configs/index.js +0 -23
  44. package/configs/json.js +0 -21
  45. package/configs/markdown.js +0 -16
  46. package/configs/node.js +0 -14
  47. package/configs/typescript.js +0 -36
  48. package/configs/vue-pug.js +0 -5
  49. package/configs/vue.js +0 -19
  50. package/configs/vue2.js +0 -11
  51. package/eslint.config.js +0 -10
  52. package/rules/index.js +0 -7
  53. package/rules/json-indent.js +0 -115
@@ -0,0 +1,19 @@
1
+ import type { Rule } from 'eslint';
2
+ declare const _default: {
3
+ meta: {
4
+ type: "layout";
5
+ docs: {
6
+ description: string;
7
+ };
8
+ fixable: "whitespace";
9
+ schema: never[];
10
+ messages: {
11
+ mixedSpaces: string;
12
+ invalidSpaces: string;
13
+ invalidDepth: string;
14
+ inLine: string;
15
+ };
16
+ };
17
+ create(context: Rule.RuleContext): Rule.RuleListener;
18
+ };
19
+ export default _default;
@@ -0,0 +1,142 @@
1
+ export default {
2
+ meta: {
3
+ type: 'layout',
4
+ docs: {
5
+ description: 'Require proper indentation with tabs in JSON files.',
6
+ },
7
+ fixable: 'whitespace',
8
+ schema: [],
9
+ messages: {
10
+ mixedSpaces: 'Invalid indentation, expected {{ expected }} tabs but found {{ found }} tabs and {{ foundSpaces }} spaces',
11
+ invalidSpaces: 'Invalid indentation, expected {{ expected }} tabs but found {{ found }} spaces',
12
+ invalidDepth: 'Invalid indentation, expected {{ expected }} tabs but found {{ found }} tabs',
13
+ inLine: 'Indentation started within a line?',
14
+ },
15
+ },
16
+ create(context) {
17
+ const text = context.sourceCode.getText();
18
+ let level = 0;
19
+ let checkedLine = -1;
20
+ function checkIndentLevel(pos, expected, node) {
21
+ if (!node.loc) {
22
+ return;
23
+ }
24
+ let found = 0;
25
+ let foundSpaces = 0;
26
+ let x = pos - 1;
27
+ for (;; x--) {
28
+ if (x < 0) {
29
+ break;
30
+ }
31
+ if (text[x] === '\t') {
32
+ found++;
33
+ }
34
+ else if (text[x] === ' ') {
35
+ foundSpaces++;
36
+ }
37
+ else {
38
+ break;
39
+ }
40
+ }
41
+ if (x > -1 && text[x] !== '\n') {
42
+ context.report({
43
+ loc: node.loc,
44
+ messageId: 'inLine',
45
+ });
46
+ return;
47
+ }
48
+ function fix(fixer) {
49
+ return fixer.replaceTextRange([x + 1, pos], '\t'.repeat(expected));
50
+ }
51
+ if (foundSpaces > 0 && found > 0) {
52
+ context.report({
53
+ loc: node.loc,
54
+ messageId: 'mixedSpaces',
55
+ data: {
56
+ expected: expected.toString(),
57
+ found: found.toString(),
58
+ foundSpaces: foundSpaces.toString(),
59
+ },
60
+ fix,
61
+ });
62
+ }
63
+ else if (foundSpaces > 0) {
64
+ context.report({
65
+ loc: node.loc,
66
+ messageId: 'invalidSpaces',
67
+ data: {
68
+ expected: expected.toString(),
69
+ found: foundSpaces.toString(),
70
+ },
71
+ fix,
72
+ });
73
+ }
74
+ else if (expected !== found) {
75
+ context.report({
76
+ loc: node.loc,
77
+ messageId: 'invalidDepth',
78
+ data: {
79
+ expected: expected.toString(),
80
+ found: found.toString(),
81
+ },
82
+ fix,
83
+ });
84
+ }
85
+ }
86
+ return {
87
+ Object(node) {
88
+ level++;
89
+ if (!node.loc) {
90
+ return;
91
+ }
92
+ checkedLine = node.loc.start.line;
93
+ },
94
+ 'Object:exit'() {
95
+ level--;
96
+ },
97
+ Member(node) {
98
+ if (!node.loc || !node.range || checkedLine === node.loc.start.line) {
99
+ return;
100
+ }
101
+ checkIndentLevel(node.range[0], level, node);
102
+ checkedLine = node.loc.start.line;
103
+ },
104
+ 'Member:exit'(node) {
105
+ if (!node.loc || !node.range || checkedLine === node.loc.end.line) {
106
+ return;
107
+ }
108
+ checkIndentLevel(node.range[1] - 1, level, node);
109
+ checkedLine = node.loc.end.line;
110
+ },
111
+ Array(node) {
112
+ level++;
113
+ if (!node.loc) {
114
+ return;
115
+ }
116
+ checkedLine = node.loc.start.line;
117
+ },
118
+ 'Array:exit'() {
119
+ level--;
120
+ },
121
+ Element(node) {
122
+ if (!node.loc || !node.range || checkedLine === node.loc.start.line) {
123
+ return;
124
+ }
125
+ // @ts-expect-error | This is bad typed, fixme
126
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument
127
+ checkIndentLevel(node.value.range[0], level, node);
128
+ checkedLine = node.loc.start.line;
129
+ },
130
+ 'Element:exit'(node) {
131
+ if (!node.loc || !node.range || checkedLine === node.loc.end.line) {
132
+ return;
133
+ }
134
+ // @ts-expect-error | This is bad typed, fixme
135
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
136
+ checkIndentLevel(node.value.range[1] - 1, level, node);
137
+ checkedLine = node.loc.end.line;
138
+ },
139
+ };
140
+ },
141
+ };
142
+ //# sourceMappingURL=json-indent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-indent.js","sourceRoot":"","sources":["../../rules/json-indent.ts"],"names":[],"mappings":"AAEA,eAAe;IACd,IAAI,EAAE;QACL,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE;YACL,WAAW,EAAE,qDAAqD;SAClE;QACD,OAAO,EAAE,YAAY;QACrB,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACT,WAAW,EAAE,2GAA2G;YACxH,aAAa,EAAE,gFAAgF;YAC/F,YAAY,EAAE,8EAA8E;YAC5F,MAAM,EAAE,oCAAoC;SAC5C;KACD;IAED,MAAM,CAAE,OAAyB;QAChC,MAAM,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,CAAA;QACzC,IAAI,KAAK,GAAG,CAAC,CAAA;QACb,IAAI,WAAW,GAAG,CAAC,CAAC,CAAA;QAEpB,SAAS,gBAAgB,CAAE,GAAW,EAAE,QAAgB,EAAE,IAAe;YACxE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;gBAAC,OAAM;YAAC,CAAC;YACzB,IAAI,KAAK,GAAG,CAAC,CAAA;YACb,IAAI,WAAW,GAAG,CAAC,CAAA;YACnB,IAAI,CAA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C,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;gBACtD,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAA;YAChC,CAAC;SACD,CAAA;IACF,CAAC;CACyB,CAAA"}
package/package.json CHANGED
@@ -1,42 +1,51 @@
1
1
  {
2
2
  "name": "@dataport/eslint-config-geodev",
3
- "version": "0.4.1",
3
+ "version": "1.0.0-alpha.2",
4
4
  "description": "Generic ESLint configuration for geo development projects at Dataport",
5
5
  "type": "module",
6
- "main": "configs/index.js",
6
+ "main": "dist/index.js",
7
7
  "exports": {
8
- ".": "./configs/index.js",
9
- "./node": "./configs/node.js",
10
- "./browser": "./configs/browser.js",
11
- "./typescript": "./configs/typescript.js",
12
- "./json": "./configs/json.js",
13
- "./markdown": "./configs/markdown.js",
14
- "./html": "./configs/html.js",
15
- "./vue": "./configs/vue.js",
16
- "./vue-pug": "./configs/vue-pug.js",
17
- "./vue2": "./configs/vue2.js"
8
+ ".": {
9
+ "types": "./dist/configs/index.d.ts",
10
+ "default": "./dist/configs/index.js"
11
+ },
12
+ "./*": {
13
+ "types": "./dist/configs/*.d.ts",
14
+ "default": "./dist/configs/*.js"
15
+ }
18
16
  },
19
17
  "scripts": {
18
+ "build": "tsc",
20
19
  "lint": "eslint .",
21
- "lint:fix": "eslint --fix ."
20
+ "lint:fix": "eslint --fix .",
21
+ "test": "echo OK",
22
+ "tsc": "tsc --noEmit",
23
+ "prepare": "husky",
24
+ "preversion": "npm run lint && npm run test && npm run tsc && npm run build",
25
+ "version": "conventional-changelog -r 1 -p conventionalcommits -t v && git add CHANGELOG.md"
22
26
  },
23
27
  "repository": {
24
28
  "type": "git",
25
29
  "url": "git+https://github.com/Dataport/eslint-config-geodev.git"
26
30
  },
27
31
  "author": "Dataport <DataportSoftwareentwicklungGeo@dataport.de>",
28
- "license": "MIT",
32
+ "license": "EUPL-1.2",
29
33
  "bugs": {
30
34
  "url": "https://github.com/Dataport/eslint-config-geodev/issues"
31
35
  },
32
36
  "homepage": "https://github.com/Dataport/eslint-config-geodev#readme",
37
+ "files": [
38
+ "dist/**/*",
39
+ "README.md",
40
+ "LICENSE"
41
+ ],
33
42
  "dependencies": {
34
43
  "@eslint/js": "^9.25.1",
35
- "@eslint/json": "^0.13.1",
44
+ "@eslint/json": "^0.14.0",
36
45
  "@eslint/markdown": "^7.1.0",
37
46
  "@html-eslint/eslint-plugin": "^0.47.0",
38
47
  "@typescript-eslint/parser": "^8.34.1",
39
- "eslint-plugin-tsdoc": "^0.4.0",
48
+ "eslint-plugin-tsdoc": "^0.5.0",
40
49
  "eslint-plugin-vue": "^10.0.0",
41
50
  "eslint-plugin-vue-pug": "^1.0.0-alpha.3",
42
51
  "globals": "^16.0.0",
@@ -45,9 +54,18 @@
45
54
  "vue-eslint-parser": "^10.1.3"
46
55
  },
47
56
  "devDependencies": {
48
- "eslint": "^9.25.1"
57
+ "@commitlint/config-conventional": "^20.0.0",
58
+ "@types/eslint": "^9.6.1",
59
+ "@types/node": "^24.7.0",
60
+ "commitlint": "^20.1.0",
61
+ "conventional-changelog": "^7.1.1",
62
+ "conventional-changelog-conventionalcommits": "^9.1.0",
63
+ "eslint": "^9.25.1",
64
+ "husky": "^9.1.7",
65
+ "jiti": "^2.6.1",
66
+ "type-fest": "^5.0.1"
49
67
  },
50
68
  "peerDependencies": {
51
69
  "eslint": ">= 9"
52
70
  }
53
- }
71
+ }
package/.editorconfig DELETED
@@ -1,4 +0,0 @@
1
- [*.{js,ts,vue,json}]
2
- indent_style = tab
3
- trim_trailing_whitespace = true
4
- insert_final_newline = true
@@ -1,21 +0,0 @@
1
- name: Publish package to npmjs
2
- on:
3
- release:
4
- types:
5
- - published
6
- jobs:
7
- build:
8
- runs-on: ubuntu-latest
9
- permissions:
10
- contents: read
11
- id-token: write
12
- steps:
13
- - uses: actions/checkout@v4
14
- - uses: actions/setup-node@v4
15
- with:
16
- node-version: '22.x'
17
- registry-url: 'https://registry.npmjs.org'
18
- - run: npm ci
19
- - run: npm publish --access public
20
- env:
21
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -1,11 +0,0 @@
1
- import globals from 'globals'
2
-
3
- export default [
4
- {
5
- languageOptions: {
6
- globals: {
7
- ...globals.browser,
8
- },
9
- },
10
- },
11
- ]
package/configs/html.js DELETED
@@ -1,10 +0,0 @@
1
- import html from '@html-eslint/eslint-plugin'
2
-
3
- export default [
4
- html.configs['flat/recommended'],
5
- {
6
- rules: {
7
- '@html-eslint/indent': ['error', 'tab'],
8
- },
9
- },
10
- ]
package/configs/index.js DELETED
@@ -1,23 +0,0 @@
1
- import js from '@eslint/js'
2
- import neostandard from 'neostandard'
3
-
4
- export default [
5
- js.configs.recommended,
6
- ...neostandard(),
7
- {
8
- rules: {
9
- 'no-console': ['error', { allow: ['warn', 'error'] }],
10
- curly: ['error', 'all'],
11
- 'no-else-return': 'error',
12
- 'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
13
- complexity: 'warn',
14
- 'max-depth': 'warn',
15
-
16
- '@stylistic/comma-dangle': ['error', 'always-multiline'],
17
- '@stylistic/indent': ['error', 'tab'],
18
- '@stylistic/no-tabs': 'off',
19
-
20
- 'import-x/order': 'error',
21
- },
22
- },
23
- ]
package/configs/json.js DELETED
@@ -1,21 +0,0 @@
1
- import json from '@eslint/json'
2
- import dataportGeodev from '../rules/index.js'
3
-
4
- export default [
5
- {
6
- plugins: {
7
- json,
8
- },
9
- language: 'json/json',
10
- ...json.configs.recommended,
11
- },
12
- {
13
- plugins: {
14
- 'dataport-geodev': dataportGeodev,
15
- },
16
- rules: {
17
- 'json/top-level-interop': 'error',
18
- 'dataport-geodev/json-indent': 'error',
19
- },
20
- },
21
- ]
@@ -1,16 +0,0 @@
1
- import markdown from '@eslint/markdown'
2
-
3
- export default [
4
- {
5
- plugins: {
6
- markdown,
7
- },
8
- language: 'json/json',
9
- },
10
- ...markdown.configs.recommended,
11
- {
12
- rules: {
13
- 'markdown/no-missing-label-refs': 'off',
14
- },
15
- },
16
- ]
package/configs/node.js DELETED
@@ -1,14 +0,0 @@
1
- import globals from 'globals'
2
-
3
- export default [
4
- {
5
- languageOptions: {
6
- globals: {
7
- ...globals.nodeBuiltin,
8
- },
9
- },
10
- rules: {
11
- 'no-console': ['error', { allow: ['warn', 'error', 'info'] }],
12
- },
13
- },
14
- ]
@@ -1,36 +0,0 @@
1
- import tseslint from 'typescript-eslint'
2
- import tsdoc from 'eslint-plugin-tsdoc'
3
-
4
- export default [
5
- ...tseslint.configs.strictTypeChecked,
6
- {
7
- languageOptions: {
8
- parserOptions: {
9
- projectService: true,
10
- ecmaVersion: 2021,
11
- sourceType: 'module',
12
- },
13
- },
14
- },
15
- {
16
- files: ['**/*.ts'],
17
- plugins: {
18
- tsdoc,
19
- },
20
- rules: {
21
- 'tsdoc/syntax': 'warn',
22
- '@typescript-eslint/naming-convention': [
23
- 'error',
24
- {
25
- selector: ['typeLike'],
26
- format: ['PascalCase'],
27
- },
28
- {
29
- selector: ['memberLike'],
30
- format: ['camelCase', 'UPPER_CASE', 'snake_case'],
31
- },
32
- ],
33
- '@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
34
- },
35
- },
36
- ]
@@ -1,5 +0,0 @@
1
- import vuePug from 'eslint-plugin-vue-pug'
2
-
3
- export default [
4
- ...vuePug.configs['flat/recommended'],
5
- ]
package/configs/vue.js DELETED
@@ -1,19 +0,0 @@
1
- import vue from 'eslint-plugin-vue'
2
- import vueParser from 'vue-eslint-parser'
3
- import tsParser from '@typescript-eslint/parser'
4
-
5
- export default [
6
- ...vue.configs['flat/recommended'],
7
- {
8
- languageOptions: {
9
- parser: vueParser,
10
- parserOptions: {
11
- parser: {
12
- js: 'espree',
13
- ts: tsParser,
14
- },
15
- extraFileExtensions: ['.vue'],
16
- },
17
- },
18
- },
19
- ]
package/configs/vue2.js DELETED
@@ -1,11 +0,0 @@
1
- import vue from 'eslint-plugin-vue'
2
-
3
- export default [
4
- ...vue.configs['flat/vue2-recommended'],
5
- {
6
- rules: {
7
- 'vue/multi-word-component-names': 'warn',
8
- 'vue/order-in-components': 'error',
9
- },
10
- },
11
- ]
package/eslint.config.js DELETED
@@ -1,10 +0,0 @@
1
- import { defineConfig } from 'eslint/config'
2
- import mainConfig from './configs/index.js'
3
- import nodeConfig from './configs/node.js'
4
-
5
- export default defineConfig([
6
- {
7
- files: ['**/*.js'],
8
- extends: [mainConfig, nodeConfig],
9
- },
10
- ])
package/rules/index.js DELETED
@@ -1,7 +0,0 @@
1
- import jsonIndent from './json-indent.js'
2
-
3
- export default {
4
- rules: {
5
- 'json-indent': jsonIndent,
6
- },
7
- }
@@ -1,115 +0,0 @@
1
- export default {
2
- meta: {
3
- type: 'layout',
4
- docs: {
5
- description: 'Require proper indentation with tabs in JSON files.',
6
- },
7
- fixable: 'whitespace',
8
- schema: [],
9
- messages: {
10
- mixedSpaces: 'Invalid indentation, expected {{ expected }} tabs but found {{ found }} tabs and {{ foundSpaces }} spaces',
11
- invalidSpaces: 'Invalid indentation, expected {{ expected }} tabs but found {{ found }} spaces',
12
- invalidDepth: 'Invalid indentation, expected {{ expected }} tabs but found {{ found }} tabs',
13
- inLine: 'Indentation started within a line?',
14
- },
15
- },
16
-
17
- create (context) {
18
- const text = context.sourceCode.getText()
19
- let level = 0
20
- let checkedLine = -1
21
-
22
- function checkIndentLevel (pos, expected, node) {
23
- let found = 0
24
- let foundSpaces = 0
25
- let x = pos - 1
26
- for (;; x--) {
27
- if (x < 0) break
28
- if (text[x] === '\t') {
29
- found++
30
- } else if (text[x] === ' ') {
31
- foundSpaces++
32
- } else break
33
- }
34
- if (x > -1 && text[x] !== '\n') {
35
- context.report({
36
- loc: node.loc,
37
- messageId: 'inLine',
38
- })
39
- return
40
- }
41
- function fix (fixer) {
42
- return fixer.replaceTextRange([x + 1, pos], '\t'.repeat(expected))
43
- }
44
- if (foundSpaces > 0 && found > 0) {
45
- context.report({
46
- loc: node.loc,
47
- messageId: 'mixedSpaces',
48
- data: {
49
- expected,
50
- found,
51
- foundSpaces,
52
- },
53
- fix,
54
- })
55
- } else if (foundSpaces > 0) {
56
- context.report({
57
- loc: node.loc,
58
- messageId: 'invalidSpaces',
59
- data: {
60
- expected,
61
- found: foundSpaces,
62
- },
63
- fix,
64
- })
65
- } else if (expected !== found) {
66
- context.report({
67
- loc: node.loc,
68
- messageId: 'invalidDepth',
69
- data: {
70
- expected,
71
- found,
72
- },
73
- fix,
74
- })
75
- }
76
- }
77
-
78
- return {
79
- Object (node) {
80
- level++
81
- checkedLine = node.loc.start.line
82
- },
83
- 'Object:exit' (node) {
84
- level--
85
- },
86
- Member (node) {
87
- if (checkedLine === node.loc.start.line) return
88
- checkIndentLevel(node.range[0], level, node)
89
- checkedLine = node.loc.start.line
90
- },
91
- 'Member:exit' (node) {
92
- if (checkedLine === node.loc.end.line) return
93
- checkIndentLevel(node.range[1] - 1, level, node)
94
- checkedLine = node.loc.end.line
95
- },
96
- Array (node) {
97
- level++
98
- checkedLine = node.loc.start.line
99
- },
100
- 'Array:exit' (node) {
101
- level--
102
- },
103
- Element (node) {
104
- if (checkedLine === node.loc.start.line) return
105
- checkIndentLevel(node.value.range[0], level, node)
106
- checkedLine = node.loc.start.line
107
- },
108
- 'Element:exit' (node) {
109
- if (checkedLine === node.loc.end.line) return
110
- checkIndentLevel(node.value.range[1] - 1, level, node)
111
- checkedLine = node.loc.end.line
112
- },
113
- }
114
- },
115
- }