flatlint 3.6.0 → 3.8.0

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 CHANGED
@@ -1,3 +1,13 @@
1
+ 2025.12.29, v3.8.0
2
+
3
+ feature:
4
+ - bf8cb8a flatlint: remove-useless-round-brace: ')]' -> ']'
5
+
6
+ 2025.12.29, v3.7.0
7
+
8
+ feature:
9
+ - 3cbe4d6 flatlint: debug -> obug
10
+
1
11
  2025.12.28, v3.6.0
2
12
 
3
13
  feature:
@@ -24,19 +24,8 @@ export const match = () => ({
24
24
 
25
25
  return true;
26
26
  },
27
- '})': (vars, path) => {
28
- let balance = 0;
29
-
30
- for (const current of path.getAllPrev()) {
31
- if (isPunctuator(current, openRoundBrace))
32
- ++balance;
33
-
34
- if (isPunctuator(current, closeRoundBrace))
35
- --balance;
36
- }
37
-
38
- return !balance;
39
- },
27
+ '})': (vars, path) => isBracesBalanced(path),
28
+ ')]': (vars, path) => !isBracesBalanced(path),
40
29
  });
41
30
 
42
31
  export const replace = () => ({
@@ -44,5 +33,20 @@ export const replace = () => ({
44
33
  'from "__b")': 'from "__b"',
45
34
  '__a);': '__a;',
46
35
  '})': '}',
36
+ ')]': ']',
47
37
  'for (__a __b of __c))': 'for (__a __b of __c)',
48
38
  });
39
+
40
+ function isBracesBalanced(path) {
41
+ let balance = 0;
42
+
43
+ for (const current of path.getAllPrev()) {
44
+ if (isPunctuator(current, openRoundBrace))
45
+ ++balance;
46
+
47
+ if (isPunctuator(current, closeRoundBrace))
48
+ --balance;
49
+ }
50
+
51
+ return !balance;
52
+ }
@@ -1,4 +1,4 @@
1
- import debug from 'debug';
1
+ import {createDebug} from 'obug';
2
2
  import {compare} from '#compare';
3
3
  import {prepare} from '#parser';
4
4
  import {
@@ -10,8 +10,12 @@ import {createPath} from './path.js';
10
10
 
11
11
  const returns = (a) => () => a;
12
12
  const {entries} = Object;
13
- const logCompare = debug('flatlint:compare');
14
- const logFix = debug('flatlint:fix');
13
+ const logCompare = createDebug('flatlint:compare', {
14
+ useColors: true,
15
+ });
16
+ const logFix = createDebug('flatlint:fix', {
17
+ useColors: true,
18
+ });
15
19
 
16
20
  export const replace = (tokens, {fix, rule, plugin}) => {
17
21
  const places = [];
@@ -1,7 +1,2 @@
1
- import {lint} from '#flatlint';
2
- import {plugins} from './plugins.js';
3
-
4
- export {
5
- lint,
6
- plugins,
7
- };
1
+ export {lint} from '#flatlint';
2
+ export {plugins} from './plugins.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flatlint",
3
- "version": "3.6.0",
3
+ "version": "3.8.0",
4
4
  "description": "JavaScript tokens-based linter",
5
5
  "main": "lib/flatlint.js",
6
6
  "type": "module",
@@ -79,8 +79,8 @@
79
79
  "dependencies": {
80
80
  "@putout/engine-loader": "^16.0.0",
81
81
  "@putout/operator-keyword": "^3.0.0",
82
- "debug": "^4.4.0",
83
- "js-tokens": "^10.0.0"
82
+ "js-tokens": "^10.0.0",
83
+ "obug": "^2.1.1"
84
84
  },
85
85
  "devDependencies": {
86
86
  "@putout/test": "^14.0.0",