Skip to content

Commit

Permalink
build: use cts extension for eslint configs (#609)
Browse files Browse the repository at this point in the history
  • Loading branch information
macalinao committed Jun 1, 2022
1 parent deb528b commit 478b745
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 7 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.js → .eslintrc.cjs
@@ -1,14 +1,17 @@
// @ts-check

"use strict";

require("@rushstack/eslint-patch/modern-module-resolution");

/** @type import('eslint').Linter.Config */
module.exports = {
env: {
browser: true,
node: true,
jest: true,
},
ignorePatterns: ["*.js"],
ignorePatterns: ["*.js", "*.cjs"],
extends: ["@saberhq/eslint-config-react"],
parserOptions: {
project: "tsconfig.json",
Expand Down
2 changes: 2 additions & 0 deletions package.json
@@ -1,5 +1,6 @@
{
"private": true,
"type": "module",
"name": "@saberhq/saber-common",
"description": "Common libraries across Saber projects.",
"workspaces": [
Expand All @@ -25,6 +26,7 @@
"@types/babel__core": "^7.1.19",
"@types/babel__preset-env": "^7.9.2",
"@types/bn.js": "^5.1.0",
"@types/eslint": "^8.4.2",
"@types/jest": "^27.5.1",
"@types/node": "^17.0.36",
"@types/react": "^18.0.9",
Expand Down
14 changes: 13 additions & 1 deletion packages/eslint-config-react/package.json
Expand Up @@ -12,10 +12,15 @@
"saber",
"react"
],
"main": "lib/eslint-config-react.js",
"type": "commonjs",
"main": "dist/cjs/eslint-config-react.cjs",
"files": [
"lib"
],
"scripts": {
"build": "tsc",
"clean": "rm -fr dist/"
},
"publishConfig": {
"access": "public"
},
Expand All @@ -27,5 +32,12 @@
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.30.0",
"eslint-plugin-react-hooks": "^4.5.0"
},
"devDependencies": {
"@saberhq/tsconfig": "workspace:^",
"@types/eslint": "^8.4.2",
"@types/node": "^17.0.38",
"eslint": "^8.16.0",
"typescript": "^4.7.2"
}
}
@@ -1,6 +1,6 @@
"use strict";
import type { Linter } from "eslint";

module.exports = {
const config: Linter.Config = {
env: {
browser: true,
},
Expand All @@ -16,3 +16,5 @@ module.exports = {
"react/no-unescaped-entities": "off",
},
};

module.exports = config;
8 changes: 8 additions & 0 deletions packages/eslint-config-react/tsconfig.json
@@ -0,0 +1,8 @@
{
"extends": "@saberhq/tsconfig/tsconfig.cjs.json",
"compilerOptions": {
"outDir": "dist/cjs/",
"types": ["node"]
},
"include": ["src/"]
}
14 changes: 13 additions & 1 deletion packages/eslint-config/package.json
Expand Up @@ -11,10 +11,15 @@
"eslint",
"saber"
],
"main": "lib/eslint-config.js",
"type": "commonjs",
"main": "dist/cjs/eslint-config.cjs",
"files": [
"lib"
],
"scripts": {
"build": "tsc",
"clean": "rm -fr dist/"
},
"publishConfig": {
"access": "public"
},
Expand All @@ -31,5 +36,12 @@
"eslint-plugin-simple-import-sort": "^7.0.0",
"eslint-plugin-unused-imports": "^2.0.0",
"prettier": "^2.6.2"
},
"devDependencies": {
"@saberhq/tsconfig": "workspace:^",
"@types/eslint": "^8.4.2",
"@types/node": "^17.0.38",
"eslint": "^8.16.0",
"typescript": "^4.7.2"
}
}
@@ -1,6 +1,6 @@
"use strict";
import type { Linter } from "eslint";

module.exports = {
const config: Linter.Config = {
root: true,
ignorePatterns: ["dist/", "*.js"],
parser: "@typescript-eslint/parser",
Expand Down Expand Up @@ -49,3 +49,5 @@ module.exports = {
],
},
};

module.exports = config;
8 changes: 8 additions & 0 deletions packages/eslint-config/tsconfig.json
@@ -0,0 +1,8 @@
{
"extends": "@saberhq/tsconfig/tsconfig.cjs.json",
"compilerOptions": {
"outDir": "dist/cjs/",
"types": ["node"]
},
"include": ["src/"]
}
28 changes: 28 additions & 0 deletions yarn.lock
Expand Up @@ -2218,9 +2218,14 @@ __metadata:
resolution: "@saberhq/eslint-config-react@workspace:packages/eslint-config-react"
dependencies:
"@saberhq/eslint-config": "workspace:^"
"@saberhq/tsconfig": "workspace:^"
"@types/eslint": ^8.4.2
"@types/node": ^17.0.38
eslint: ^8.16.0
eslint-plugin-jsx-a11y: ^6.5.1
eslint-plugin-react: ^7.30.0
eslint-plugin-react-hooks: ^4.5.0
typescript: ^4.7.2
peerDependencies:
eslint: ">=7"
languageName: unknown
Expand All @@ -2230,15 +2235,20 @@ __metadata:
version: 0.0.0-use.local
resolution: "@saberhq/eslint-config@workspace:packages/eslint-config"
dependencies:
"@saberhq/tsconfig": "workspace:^"
"@types/eslint": ^8.4.2
"@types/node": ^17.0.38
"@typescript-eslint/eslint-plugin": ^5.26.0
"@typescript-eslint/parser": ^5.26.0
eslint: ^8.16.0
eslint-config-prettier: ^8.5.0
eslint-import-resolver-node: ^0.3.6
eslint-plugin-import: ^2.26.0
eslint-plugin-prettier: ^4.0.0
eslint-plugin-simple-import-sort: ^7.0.0
eslint-plugin-unused-imports: ^2.0.0
prettier: ^2.6.2
typescript: ^4.7.2
peerDependencies:
eslint: ">=7"
languageName: unknown
Expand Down Expand Up @@ -2273,6 +2283,7 @@ __metadata:
"@types/babel__core": ^7.1.19
"@types/babel__preset-env": ^7.9.2
"@types/bn.js": ^5.1.0
"@types/eslint": ^8.4.2
"@types/jest": ^27.5.1
"@types/node": ^17.0.36
"@types/react": ^18.0.9
Expand Down Expand Up @@ -3013,6 +3024,16 @@ __metadata:
languageName: node
linkType: hard

"@types/eslint@npm:^8.4.2":
version: 8.4.2
resolution: "@types/eslint@npm:8.4.2"
dependencies:
"@types/estree": "*"
"@types/json-schema": "*"
checksum: e81268cdeb8d64d84af649344df88f064ece0f05db62072657c976b6162ffe16f94b6480a5367d627c629272c2d86d0ee8c24f7095e98f8e743b16f98500673b
languageName: node
linkType: hard

"@types/estree@npm:*, @types/estree@npm:^0.0.51":
version: 0.0.51
resolution: "@types/estree@npm:0.0.51"
Expand Down Expand Up @@ -3165,6 +3186,13 @@ __metadata:
languageName: node
linkType: hard

"@types/node@npm:^17.0.38":
version: 17.0.38
resolution: "@types/node@npm:17.0.38"
checksum: 9db1c39d603850ced665ab60b8f8ebce674ff9d762dfff0f776d520e71e4d73fdcd4c7f69213b804d878cf3e726911b09cae4ee66e35ae2724538de9f4838681
languageName: node
linkType: hard

"@types/prettier@npm:^2.1.5":
version: 2.6.0
resolution: "@types/prettier@npm:2.6.0"
Expand Down

0 comments on commit 478b745

Please sign in to comment.