Skip to content

Commit

Permalink
fix: Use kebab case for exported rule names (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhamlin authored Jan 17, 2023
1 parent 4e32dc1 commit 4ef1cf4
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 17 deletions.
4 changes: 2 additions & 2 deletions __tests__/rules/forbid-pattern-everywhere.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { TestCaseError } from '@typescript-eslint/utils/dist/ts-eslint';
import dedent from 'dedent';

import rule from '../../src/rules/forbid-pattern-everywhere';
import { name, rule } from '../../src/rules/forbid-pattern-everywhere';
import { ruleTester } from '../rule-tester';

describe('Rule Tests', () => {
function getErrors(pattern: string): TestCaseError<'disallowedPattern'>[] {
return [{ messageId: `disallowedPattern`, data: { pattern } }];
}

ruleTester.run('forbid-pattern-everywhere', rule, {
ruleTester.run(name, rule, {
valid: [
{
// No options/patterns specified
Expand Down
4 changes: 2 additions & 2 deletions __tests__/rules/no-empty-block-comment.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import dedent from 'dedent';

import rule from '../../src/rules/no-empty-block-comment';
import { name, rule } from '../../src/rules/no-empty-block-comment';
import { ruleTester } from '../rule-tester';

describe('Rule Tests', () => {
const errors = [{ messageId: 'nonEmptyBlockComment' as const }];

ruleTester.run('no-empty-block-comment', rule, {
ruleTester.run(name, rule, {
valid: [
{
code: dedent`
Expand Down
7 changes: 7 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import excludePatternEverywhere from './src/rules/forbid-pattern-everywhere';
import noEmptyBlockComment from './src/rules/no-empty-block-comment';

export const rules = {
[excludePatternEverywhere.name]: excludePatternEverywhere.rule,
[noEmptyBlockComment.name]: noEmptyBlockComment.rule,
};
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default async (): Promise<Config.InitialOptions> => ({
coverageDirectory: '<rootDir>/coverage',

// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: ['<rootDir>/src/index.ts'],
// coveragePathIgnorePatterns: ['<rootDir>/src/index.ts'],

// Indicates which provider should be used to instrument code for coverage
// coverageProvider: 'v8',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"/docs"
],
"scripts": {
"prepare": "husky install",
"prepare": "husky install && npm run compile",
"_lint": "eslint --fix",
"_lint:check": "eslint",
"eslint-docs": "eslint-doc-generator",
Expand Down
7 changes: 0 additions & 7 deletions src/index.ts

This file was deleted.

7 changes: 5 additions & 2 deletions src/rules/forbid-pattern-everywhere.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { TSESTree } from '@typescript-eslint/utils';

import { createRule } from '../utils/create-rule';

export default createRule({
name: 'forbid-pattern-everywhere',
export const name = 'forbid-pattern-everywhere';
export const rule = createRule({
name,
meta: {
type: 'layout',
messages: {
Expand Down Expand Up @@ -75,3 +76,5 @@ export default createRule({
};
},
});

export default { name, rule };
7 changes: 5 additions & 2 deletions src/rules/no-empty-block-comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { TSESTree } from '@typescript-eslint/utils';

import { createRule } from '../utils/create-rule';

export default createRule({
name: 'no-empty-block-comment',
export const name = 'no-empty-block-comment';
export const rule = createRule({
name,
meta: {
type: 'layout',
messages: {
Expand Down Expand Up @@ -45,3 +46,5 @@ export default createRule({
};
},
});

export default { name, rule };

0 comments on commit 4ef1cf4

Please sign in to comment.