eslint-plugin-perfectionist 3.9.0 → 3.9.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.
@@ -70,7 +70,8 @@ const sortSwitchCase = createEslintRule.createEslintRule({
70
70
  order: 'asc',
71
71
  })
72
72
  let sourceCode = getSourceCode.getSourceCode(context)
73
- let isDiscriminantIdentifier = node.discriminant.type === 'Identifier'
73
+ let isDiscriminantTrue =
74
+ node.discriminant.type === 'Literal' && node.discriminant.value === true
74
75
  let isCasesHasBreak = node.cases
75
76
  .filter(caseNode => caseNode.test !== null)
76
77
  .every(
@@ -83,7 +84,7 @@ const sortSwitchCase = createEslintRule.createEslintRule({
83
84
  currentConsequent.type === 'BlockStatement',
84
85
  ),
85
86
  )
86
- if (isDiscriminantIdentifier && isCasesHasBreak) {
87
+ if (!isDiscriminantTrue && isCasesHasBreak) {
87
88
  let nodes = node.cases.map(caseNode => {
88
89
  var _a, _b
89
90
  let name
@@ -69,7 +69,8 @@ const sortSwitchCase = createEslintRule({
69
69
  order: 'asc',
70
70
  })
71
71
  let sourceCode = getSourceCode(context)
72
- let isDiscriminantIdentifier = node.discriminant.type === 'Identifier'
72
+ let isDiscriminantTrue =
73
+ node.discriminant.type === 'Literal' && node.discriminant.value === true
73
74
  let isCasesHasBreak = node.cases
74
75
  .filter(caseNode => caseNode.test !== null)
75
76
  .every(
@@ -82,7 +83,7 @@ const sortSwitchCase = createEslintRule({
82
83
  currentConsequent.type === 'BlockStatement',
83
84
  ),
84
85
  )
85
- if (isDiscriminantIdentifier && isCasesHasBreak) {
86
+ if (!isDiscriminantTrue && isCasesHasBreak) {
86
87
  let nodes = node.cases.map(caseNode => {
87
88
  var _a, _b
88
89
  let name
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "eslint-plugin-perfectionist",
3
3
  "description": "ESLint plugin for sorting various data such as objects, imports, types, enums, JSX props, etc.",
4
- "version": "3.9.0",
4
+ "version": "3.9.1",
5
5
  "homepage": "https://perfectionist.dev",
6
6
  "repository": "azat-io/eslint-plugin-perfectionist",
7
7
  "author": "Azat S. <to@azat.io>",
package/readme.md CHANGED
@@ -11,7 +11,7 @@
11
11
  [![Version](https://img.shields.io/npm/v/eslint-plugin-perfectionist.svg?color=4a32c3&labelColor=26272b)](https://npmjs.com/package/eslint-plugin-perfectionist)
12
12
  [![Monthly Download](https://img.shields.io/npm/dm/eslint-plugin-perfectionist.svg?color=4a32c3&labelColor=26272b)](https://npmjs.com/package/eslint-plugin-perfectionist)
13
13
  [![Code Coverage](https://img.shields.io/codecov/c/github/azat-io/eslint-plugin-perfectionist.svg?color=4a32c3&labelColor=26272b)](https://npmjs.com/package/eslint-plugin-perfectionist)
14
- [![GitHub License](https://img.shields.io/badge/license-MIT-232428.svg?color=4a32c3&labelColor=26272b)](https://github.com/azat-io/eslint-plugin-perfectionist/blob/main/license)
14
+ [![GitHub License](https://img.shields.io/badge/license-MIT-232428.svg?color=4a32c3&labelColor=26272b)](https://github.com/azat-io/eslint-plugin-perfectionist/blob/main/license.md)
15
15
 
16
16
  ESLint plugin that sets rules to format your code and make it consistent.
17
17