@1024pix/eslint-plugin 1.2.0 → 1.2.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/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
+ ## [1.2.1](https://github.com/1024pix/eslint-plugin/compare/v1.2.0...v1.2.1) (2024-05-29)
2
+
1
3
  # [1.2.0](https://github.com/1024pix/eslint-plugin/compare/v1.1.3...v1.2.0) (2024-05-23)
2
4
 
3
5
  ### :rocket: Amélioration
package/config.js CHANGED
@@ -1,11 +1,9 @@
1
1
  const { resolve } = require('node:path');
2
2
 
3
3
  const js = require('@eslint/js');
4
- const { fixupPluginRules } = require('@eslint/compat');
5
4
  const comments = require('@eslint-community/eslint-plugin-eslint-comments/configs');
6
5
  const eslintPluginYml = require('eslint-plugin-yml');
7
6
  const simpleImportSort = require('eslint-plugin-simple-import-sort');
8
- const i18nJson = require('eslint-plugin-i18n-json');
9
7
  const pixPlugin = require('./index.js');
10
8
 
11
9
  module.exports = [
@@ -14,7 +12,6 @@ module.exports = [
14
12
  comments.recommended,
15
13
  {
16
14
  plugins: {
17
- 'i18n-json': fixupPluginRules(i18nJson),
18
15
  '@1024pix': pixPlugin,
19
16
  'simple-import-sort': simpleImportSort,
20
17
  },
@@ -96,12 +93,6 @@ module.exports = [
96
93
  avoidEscape: true,
97
94
  },
98
95
  ],
99
- 'i18n-json/sorted-keys': [
100
- 'error',
101
- {
102
- sortFunctionPath: resolve(__dirname, './json/sort-translations.js'),
103
- },
104
- ],
105
96
  '@1024pix/no-sinon-stub-with-args-oneliner': 'error',
106
97
  },
107
98
  },
package/package.json CHANGED
@@ -1,20 +1,16 @@
1
1
  {
2
2
  "name": "@1024pix/eslint-plugin",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Des règles de lint pour les projets 1024pix",
5
5
  "exports": {
6
6
  ".": "./index.js",
7
7
  "./config": "./config.js"
8
8
  },
9
9
  "scripts": {
10
- "test:plugin": "node rules/*.test.js",
11
- "test:config": "node json/*.test.js",
12
- "test": "npm run test:plugin && npm run test:config"
10
+ "test": "node rules/*.test.js"
13
11
  },
14
12
  "dependencies": {
15
13
  "@eslint-community/eslint-plugin-eslint-comments": "^4.3.0",
16
- "@eslint/compat": "^1.0.1",
17
- "eslint-plugin-i18n-json": "^4.0.0",
18
14
  "eslint-plugin-simple-import-sort": "^12.1.0",
19
15
  "eslint-plugin-yml": "^1.14.0"
20
16
  },
@@ -1,16 +0,0 @@
1
- module.exports = (translations) => {
2
- return Object.keys(translations).sort((keyA, keyB) => {
3
- if (keyB == 'current-lang' || keyB == 'title') {
4
- return 1;
5
- } else if (keyA == 'current-lang' || keyA == 'title') {
6
- return -1;
7
- }
8
- if (keyA == keyB) {
9
- return 0;
10
- } else if (keyA < keyB) {
11
- return -1;
12
- } else {
13
- return 1;
14
- }
15
- });
16
- };
@@ -1,73 +0,0 @@
1
- const { describe, it } = require('node:test');
2
- const { deepStrictEqual } = require('node:assert');
3
- const sortTranslations = require('./sort-translations.js');
4
-
5
- describe('#sortTranslation', () => {
6
- it('should sort keys alphabetically', () => {
7
- // Given
8
- const translations = {
9
- d: 'Daniel',
10
- a: 'Alpha',
11
- c: 'Charly',
12
- b: 'Beta',
13
- };
14
- const expectedResult = ['a', 'b', 'c', 'd'];
15
-
16
- // When
17
- const result = sortTranslations(translations);
18
-
19
- // Then
20
- deepStrictEqual(result, expectedResult);
21
- });
22
-
23
- it('should put the `title` key on top', () => {
24
- // Given
25
- const translations = {
26
- d: 'Daniel',
27
- a: 'Alpha',
28
- title: 'should be first',
29
- c: 'Charly',
30
- b: 'Beta',
31
- };
32
- const expectedResult = ['title', 'a', 'b', 'c', 'd'];
33
-
34
- // When
35
- const result = sortTranslations(translations);
36
-
37
- // Then
38
- deepStrictEqual(result, expectedResult);
39
- });
40
-
41
- it('should put the `current-lang` key on top', () => {
42
- // Given
43
- const translations = {
44
- d: 'Daniel',
45
- a: 'Alpha',
46
- 'current-lang': 'should be first',
47
- c: 'Charly',
48
- b: 'Beta',
49
- };
50
- const expectedResult = ['current-lang', 'a', 'b', 'c', 'd'];
51
-
52
- // When
53
- const result = sortTranslations(translations);
54
-
55
- // Then
56
- deepStrictEqual(result, expectedResult);
57
- });
58
-
59
- it('should put the `title` key before the `current-lang` key', () => {
60
- // Given
61
- const translations = {
62
- title: 'should be second',
63
- 'current-lang': 'should be first',
64
- };
65
- const expectedResult = ['title', 'current-lang'];
66
-
67
- // When
68
- const result = sortTranslations(translations);
69
-
70
- // Then
71
- deepStrictEqual(result, expectedResult);
72
- });
73
- });