Skip to content

Commit

Permalink
Merge pull request #10 from alienfast/add-ts-react-tweaks
Browse files Browse the repository at this point in the history
Add ts react tweaks
  • Loading branch information
rosskevin authored Jul 6, 2024
2 parents 0ce13fc + f91c028 commit b2752a9
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 18 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"eslint-plugin-markdown": "^5.0.0",
"eslint-plugin-n": "^17.9.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react-hooks": "^5.1.0-rc-3da26163a3-20240704",
"eslint-plugin-react-hooks": "^5.1.0-rc-f38c22b244-20240704",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-storybook": "0.9.0--canary.156.26b630a.0",
"eslint-plugin-unicorn": "^54.0.0",
Expand All @@ -77,7 +77,7 @@
"husky": "^9.0.11",
"lint-staged": "^15.2.7",
"prettier": "^3.3.2",
"rimraf": "^5.0.7",
"rimraf": "^5.0.8",
"typescript": "^5.5.3"
},
"peerDependencies": {
Expand Down
17 changes: 10 additions & 7 deletions src/configs/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,15 @@ const configs = tseslint.config(
'@typescript-eslint/parser': ALL_JS_FILES,
},
'import-x/resolver': {
typescript: {
alwaysTryTypes: true,
project: ['packages/*/tsconfig.json'],
},
node: {
extensions: ALL_JS_FILES,
},
typescript: true,
node: true,
// typescript: {
// alwaysTryTypes: true,
// project: ['packages/*/tsconfig.json'],
// },
// node: {
// extensions: ALL_JS_FILES,
// },
},
},
plugins: {
Expand Down Expand Up @@ -123,6 +125,7 @@ const configs = tseslint.config(
},
],
'@typescript-eslint/member-ordering': 'error',
'@typescript-eslint/no-base-to-string': 'off', // annoying about stringifying objects
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-explicit-any': 'off',
Expand Down
2 changes: 2 additions & 0 deletions src/limits/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import jsOnly from './jsOnly.js'
import jsOnlyScripts from './jsOnlyScripts.js'
import react from './react.js'

const ruleset = {
jsOnly,
jsOnlyScripts,
react,
}
export default ruleset
2 changes: 1 addition & 1 deletion src/limits/jsOnly.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { JS_FILES } from '../constants.js'
* View config with `npx @eslint/config-inspector`
*/
const configs = tseslint.config({
name: 'alienfast-js-only',
name: 'alienfast-limits-js-only',
files: JS_FILES,
...tseslint.configs.disableTypeChecked,
// rules: {
Expand Down
2 changes: 1 addition & 1 deletion src/limits/jsOnlyScripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import jsOnly from './jsOnly.js'
* View config with `npx @eslint/config-inspector`
*/
const configs = tseslint.config({
name: 'alienfast-js-only-scripts',
name: 'alienfast-limits-js-only-scripts',
extends: [...jsOnly],
files: SCRIPTS,
rules: {
Expand Down
22 changes: 22 additions & 0 deletions src/limits/react.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import tseslint from 'typescript-eslint'

import { JS_FILES } from '../constants.js'

/**
* Turn off rules not necessary for js only files.
*
* Do not extend configs, it will alter files/ignores behavior.
*
* View config with `npx @eslint/config-inspector`
*/
const configs = tseslint.config({
name: 'alienfast-limits-react',
files: JS_FILES,
rules: {
// this gets really messy in tsx and graphql when types are forced to any e.g. policies
'@typescript-eslint/no-unsafe-assignment': 'off', // 57% of the time
'@typescript-eslint/no-unsafe-member-access': 'off',
},
})

export default configs
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ __metadata:
eslint-plugin-markdown: "npm:^5.0.0"
eslint-plugin-n: "npm:^17.9.0"
eslint-plugin-prettier: "npm:^5.1.3"
eslint-plugin-react-hooks: "npm:^5.1.0-rc-3da26163a3-20240704"
eslint-plugin-react-hooks: "npm:^5.1.0-rc-f38c22b244-20240704"
eslint-plugin-simple-import-sort: "npm:^12.1.1"
eslint-plugin-storybook: "npm:0.9.0--canary.156.26b630a.0"
eslint-plugin-unicorn: "npm:^54.0.0"
Expand All @@ -39,7 +39,7 @@ __metadata:
husky: "npm:^9.0.11"
lint-staged: "npm:^15.2.7"
prettier: "npm:^3.3.2"
rimraf: "npm:^5.0.7"
rimraf: "npm:^5.0.8"
typescript: "npm:^5.5.3"
typescript-eslint: "npm:^7.15.0"
peerDependencies:
Expand Down Expand Up @@ -2153,7 +2153,7 @@ __metadata:
languageName: node
linkType: hard

"eslint-plugin-react-hooks@npm:^5.1.0-rc-3da26163a3-20240704":
"eslint-plugin-react-hooks@npm:^5.1.0-rc-f38c22b244-20240704":
version: 5.1.0-rc-fb9a90fa48-20240614
resolution: "eslint-plugin-react-hooks@npm:5.1.0-rc-fb9a90fa48-20240614"
peerDependencies:
Expand Down Expand Up @@ -4586,14 +4586,14 @@ __metadata:
languageName: node
linkType: hard

"rimraf@npm:^5.0.7":
version: 5.0.7
resolution: "rimraf@npm:5.0.7"
"rimraf@npm:^5.0.8":
version: 5.0.8
resolution: "rimraf@npm:5.0.8"
dependencies:
glob: "npm:^10.3.7"
bin:
rimraf: dist/esm/bin.mjs
checksum: 10/1e3cecfe59ee2383dfd9ba5373caeed48ed941318a0360119419b7dffc63115661408b9427f67e1f66b5bbb8855a3953db09e55a7362b3df904a44453dfa22fb
checksum: 10/ab8f1bcb49762d16120813a127f90773da657bb5c6f29d3865c1b3c1ceb0d2291cd3e7b439adb7571024be47dce8443b3ffd1b116ec78b6122fca0571da87a79
languageName: node
linkType: hard

Expand Down

0 comments on commit b2752a9

Please sign in to comment.