Skip to content

Commit

Permalink
chore: add custom eslint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
daibhin committed Oct 26, 2023
1 parent 22b2dfd commit f307f2e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 18 deletions.
10 changes: 10 additions & 0 deletions eslint-rules/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const { readdirSync } = require('fs')
const { basename } = require('path')

const ruleFiles = readdirSync('eslint-rules').filter(
(file) => file.endsWith('.js') && file !== 'index.js' && !file.endsWith('test.js')
)

const rules = Object.fromEntries(ruleFiles.map((file) => [basename(file, '.js'), require('./' + file)]))

module.exports = { rules }
12 changes: 0 additions & 12 deletions eslint-rules/index.ts

This file was deleted.

3 changes: 3 additions & 0 deletions eslint-rules/warn-elements.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const { rules } = require('eslint-plugin-react')

module.exports = rules['forbid-elements']
3 changes: 0 additions & 3 deletions eslint-rules/warn-elements.ts

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-jest": "^27.4.3",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-posthog": "link:eslint-rules",
"eslint-plugin-posthog": "link:./eslint-rules",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-storybook": "^0.6.15",
Expand Down
4 changes: 2 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f307f2e

Please sign in to comment.