Skip to content

Commit

Permalink
fix: fix to export formatting rules (#521)
Browse files Browse the repository at this point in the history
- use hard code `RULE_NAME` instead of `getFilename` util
  • Loading branch information
azu authored Aug 28, 2024
1 parent d940d0b commit 054121b
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 21 deletions.
3 changes: 1 addition & 2 deletions src/rules/padding-around-after-all-blocks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { getFilename } from "../utils/msc"
import { Config, PaddingType, StatementType, createPaddingRule } from "../utils/padding"

export const RULE_NAME = getFilename(import.meta.url)
export const RULE_NAME = 'padding-around-after-all-blocks'

export const config: Config[] = [
{
Expand Down
3 changes: 1 addition & 2 deletions src/rules/padding-around-after-each-blocks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Config, PaddingType, StatementType, createPaddingRule } from "../utils/padding";
import { getFilename } from "../utils/msc";

export const RULE_NAME = getFilename(import.meta.url)
export const RULE_NAME = 'padding-around-after-each-blocks'

export const config: Config[] = [
{
Expand Down
3 changes: 1 addition & 2 deletions src/rules/padding-around-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import { config as paddingAroundDescribeBlocksConfig } from './padding-around-de
import { config as paddingAroundExpectGroupsConfig } from './padding-around-expect-groups';
import { config as paddingAroundTestBlocksConfig } from './padding-around-test-blocks';
import { createPaddingRule } from '../utils/padding';
import { getFilename } from '../utils/msc';

export const RULE_NAME = getFilename(import.meta.url)
export const RULE_NAME = 'padding-around-all'

export default createPaddingRule(
RULE_NAME,
Expand Down
3 changes: 1 addition & 2 deletions src/rules/padding-around-before-all-blocks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { getFilename } from "../utils/msc";
import { Config, PaddingType, StatementType, createPaddingRule } from "../utils/padding";

export const RULE_NAME = getFilename(import.meta.url)
export const RULE_NAME = 'padding-around-before-all-blocks'

export const config: Config[] = [
{
Expand Down
3 changes: 1 addition & 2 deletions src/rules/padding-around-before-each-blocks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { getFilename } from '../utils/msc';
import { PaddingType, StatementType, createPaddingRule } from '../utils/padding';

export const RULE_NAME = getFilename(import.meta.url)
export const RULE_NAME = 'padding-around-before-each-blocks'

export const config = [
{
Expand Down
3 changes: 1 addition & 2 deletions src/rules/padding-around-describe-blocks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { getFilename } from '../utils/msc';
import { Config, PaddingType, StatementType, createPaddingRule } from '../utils/padding';

export const RULE_NAME = getFilename(import.meta.url)
export const RULE_NAME = 'padding-around-describe-blocks'

export const config: Config[] = [
{
Expand Down
3 changes: 1 addition & 2 deletions src/rules/padding-around-expect-groups.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { getFilename } from "../utils/msc";
import { Config, PaddingType, StatementType, createPaddingRule } from "../utils/padding";

export const RULE_NAME = getFilename(import.meta.url)
export const RULE_NAME = 'padding-around-expect-groups'

export const config: Config[] = [
{
Expand Down
3 changes: 1 addition & 2 deletions src/rules/padding-around-test-blocks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { getFilename } from '../utils/msc';
import { PaddingType, StatementType, createPaddingRule } from '../utils/padding';

export const RULE_NAME = getFilename(import.meta.url)
export const RULE_NAME = 'padding-around-test-blocks'

export const config = [
{
Expand Down
5 changes: 0 additions & 5 deletions src/utils/msc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,3 @@ export interface CallExpressionWithSingleArgument<
export const hasOnlyOneArgument = (
call: TSESTree.CallExpression
): call is CallExpressionWithSingleArgument => call.arguments.length === 1


export function getFilename(url: string) {
return parse(basename(fileURLToPath(url))).name
}

0 comments on commit 054121b

Please sign in to comment.