Skip to content

Commit

Permalink
eslint-config: Minor updates (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
nhardy authored Nov 30, 2023
1 parent c79dc2e commit 9d26f0a
Show file tree
Hide file tree
Showing 8 changed files with 226 additions and 218 deletions.
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,26 @@
"dependencies": {
"@babel/core": "^7.23.3",
"@babel/eslint-parser": "^7.23.3",
"@babel/plugin-transform-runtime": "^7.23.3",
"@babel/plugin-transform-runtime": "^7.23.4",
"@babel/preset-env": "^7.23.3",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@babel/register": "^7.22.15",
"@changesets/cli": "^2.26.2",
"@manypkg/cli": "^0.21.0",
"@testing-library/jest-dom": "^6.1.4",
"@types/babel__core": "^7.20.4",
"@types/babel__core": "^7.20.5",
"@types/content-type": "^1.1.8",
"@types/jest": "^29.5.8",
"@types/jest": "^29.5.10",
"@types/jest-when": "^3.5.5",
"@types/lodash": "^4.14.201",
"@types/node": "^20.9.0",
"@types/react-dom": "^18.2.15",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"@types/lodash": "^4.14.202",
"@types/node": "^20.9.5",
"@types/react-dom": "^18.2.17",
"@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.12.0",
"babel-plugin-import": "^1.13.8",
"core-js": "^3.33.2",
"eslint": "^8.53.0",
"core-js": "^3.33.3",
"eslint": "^8.54.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-node": "^0.3.9",
"eslint-plugin-prettier": "^5.0.1",
Expand All @@ -85,6 +85,6 @@
"react-dom": "^18.2.0",
"rimraf": "^5.0.5",
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
"typescript": "^5.3.2"
}
}
51 changes: 26 additions & 25 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
// @ts-check

const TS_EXTS = /** @type {const} */ ([".ts", ".cts", ".mts"]);
const JS_EXTS = /** @type {const} */ ([".js", ".cjs", ".mjs"]);
const TSX_EXTS = TS_EXTS.map((ext) => /** @type {const} */ (`${ext}x`));
const JSX_EXTS = JS_EXTS.map((ext) => /** @type {const} */ (`${ext}x`));
const STAR_TS_EXTS = TS_EXTS.map((ext) => /** @type {const} */ (`*${ext}`));
const STAR_TSX_EXTS = TSX_EXTS.map((ext) => /** @type {const} */ (`*${ext}`));
const STAR_JS_EXTS = JS_EXTS.map((ext) => /** @type {const} */ (`*${ext}`));
const STAR_JSX_EXTS = JSX_EXTS.map((ext) => /** @type {const} */ (`*${ext}`));
const STAR_DTS_EXTS = TS_EXTS.map((ext) => /** @type {const} */ (`.d${ext}`));

/** @satisfies {import("eslint").Linter.Config} */
module.exports = {
env: {
Expand All @@ -17,18 +27,11 @@ module.exports = {
plugins: ["@kablamo", "@typescript-eslint", "prettier"],
settings: {
"import/parsers": {
"@typescript-eslint/parser": [
".ts",
".tsx",
".cts",
".ctsx",
".mts",
".mtsx",
],
"@typescript-eslint/parser": [...TS_EXTS, ...TSX_EXTS],
},
"import/resolver": {
node: {
extensions: [".ts", ".tsx", ".cts", ".ctsx", ".mts", ".mtsx"],
extensions: [...TS_EXTS, ...TSX_EXTS],
},
typescript: true,
},
Expand Down Expand Up @@ -101,9 +104,11 @@ module.exports = {
"react/function-component-definition": "off",
"react/jsx-filename-extension": [
"error",
{ allow: "always", extensions: [".tsx"] },
{ allow: "always", extensions: [...TSX_EXTS, ...JSX_EXTS] },
],
"react/react-in-jsx-scope": "off",
"react/jsx-key": "error",
"react/jsx-no-useless-fragment": ["error", { allowExpressions: true }],
"react/jsx-props-no-spreading": "off",
// Allow Emotion css prop
"react/no-unknown-property": ["error", { ignore: ["css"] }],
Expand All @@ -123,13 +128,14 @@ module.exports = {
},
overrides: [
{
files: ["*.js"],
// CommonJS files only
files: ["*.js", "*.cjs"],
rules: {
"@typescript-eslint/no-var-requires": "off",
},
},
{
files: ["*.ts", "*.tsx", "*.cts", ".ctsx", "*.mts", "*.mtsx"],
files: [...STAR_TS_EXTS, ...STAR_TSX_EXTS],
extends: [
"plugin:@typescript-eslint/recommended-requiring-type-checking",
],
Expand All @@ -153,6 +159,9 @@ module.exports = {
// ESLint rules superseded by @typescript-eslint rules
"no-shadow": "off",
"@typescript-eslint/no-shadow": "error",
// Allow void to be used to signify intentional ignoring of a Promise result
"no-void": "off",
"@typescript-eslint/no-meaningless-void-operator": "error",

// Autofix for type-only imports
"@typescript-eslint/consistent-type-imports": [
Expand Down Expand Up @@ -185,7 +194,7 @@ module.exports = {
},
},
{
files: ["*.d.ts", "*.d.cts", "*.d.mts"],
files: STAR_DTS_EXTS,
rules: {
// False positives across module declarations
"import/duplicates": "off",
Expand All @@ -204,18 +213,10 @@ module.exports = {
},
{
files: [
"*.js",
"*.ts",
"*.jsx",
"*.tsx",
"*.cjs",
"*.cts",
"*.cjsx",
"*.ctsx",
"*.mjs",
"*.mts",
"*.mjsx",
"*.mtsx",
...STAR_TS_EXTS,
...STAR_TSX_EXTS,
...STAR_JS_EXTS,
...STAR_JSX_EXTS,
],
rules: {
"@typescript-eslint/naming-convention": [
Expand Down
8 changes: 4 additions & 4 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kablamo/eslint-config",
"version": "0.0.16",
"version": "0.0.17",
"main": "index.js",
"repository": "https://github.com/KablamoOSS/kerosene/tree/master/packages/eslint-config",
"bugs": {
Expand All @@ -18,15 +18,15 @@
"eslint": "^7 || ^8"
},
"devDependencies": {
"eslint": "^8.53.0"
"eslint": "^8.54.0"
},
"engines": {
"node": ">=18.12.0"
},
"dependencies": {
"@kablamo/eslint-plugin": "^2.0.1",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.12.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-node": "^0.3.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
},
"devDependencies": {
"@types/eslint": "^8.44.7",
"eslint": "^8.53.0"
"eslint": "^8.54.0"
}
}
4 changes: 2 additions & 2 deletions packages/kerosene-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
],
"dependencies": {
"@kablamo/kerosene": "^0.0.29",
"@types/lodash": "^4.14.201",
"@types/sinon": "^17.0.1",
"@types/lodash": "^4.14.202",
"@types/sinon": "^17.0.2",
"lodash": "^4.17.21",
"sinon": "^17.0.1"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/kerosene-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"node": ">=18.12.0"
},
"dependencies": {
"@babel/runtime": "^7.23.2",
"@babel/runtime": "^7.23.4",
"@kablamo/kerosene": "^0.0.29",
"@types/lodash": "^4.14.201",
"@types/lodash": "^4.14.202",
"lodash": "^4.17.21",
"use-sync-external-store": "^1.2.0"
},
Expand All @@ -32,15 +32,15 @@
"@rollup/plugin-babel": "^6.0.4",
"@sinonjs/fake-timers": "^11.2.2",
"@testing-library/dom": "^9.3.3",
"@testing-library/react": "^14.1.0",
"@testing-library/react": "^14.1.2",
"@testing-library/user-event": "^14.5.1",
"@types/sinonjs__fake-timers": "^8.1.5",
"@types/use-sync-external-store": "^0.0.6",
"jest-sandbox": "^1.1.2",
"jest-when": "^3.6.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rollup": "^4.4.0",
"rollup": "^4.5.1",
"rollup-plugin-node-resolve": "^5.2.0"
},
"peerDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions packages/kerosene/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
"node": ">=18.12.0"
},
"dependencies": {
"@babel/runtime": "^7.23.2",
"@types/lodash": "^4.14.201",
"@babel/runtime": "^7.23.4",
"@types/lodash": "^4.14.202",
"content-type": "^1.0.5",
"core-js-pure": "^3.33.2",
"core-js-pure": "^3.33.3",
"date-fns": "^2.30.0",
"lodash": "^4.17.21"
},
Expand All @@ -33,7 +33,7 @@
"@sinonjs/fake-timers": "^11.2.2",
"@types/seed-random": "^2.2.4",
"jest-when": "^3.6.0",
"rollup": "^4.4.0",
"rollup": "^4.5.1",
"rollup-plugin-node-resolve": "^5.2.0",
"seed-random": "^2.2.0"
},
Expand Down
Loading

0 comments on commit 9d26f0a

Please sign in to comment.