Skip to content

Commit 3517911

Browse files
committed
Even more explicit extensions
1 parent de5a173 commit 3517911

9 files changed

Lines changed: 18 additions & 21 deletions

File tree

eslint.config.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ module.exports = [
102102
"simple-import-sort/exports": "error",
103103
"sort-imports": "off",
104104
"import-x/order": "off",
105+
// Forbid: `import x from "./foo"`; require `"./foo.ts"`
106+
"import-x/extensions": [
107+
"error",
108+
"ignorePackages",
109+
{ checkTypeImports: true },
110+
],
105111

106112
"import-x/no-deprecated": "warn",
107113
"import-x/no-duplicates": "error",
@@ -123,12 +129,6 @@ module.exports = [
123129
project: true,
124130
},
125131
rules: {
126-
// Forbid: `import x from "./foo"`; require `"./foo.ts"`
127-
"import-x/extensions": [
128-
"error",
129-
"ignorePackages",
130-
{ checkTypeImports: true },
131-
],
132132
"@typescript-eslint/consistent-type-exports": "error",
133133
"@typescript-eslint/consistent-type-imports": "error",
134134
},
@@ -137,12 +137,6 @@ module.exports = [
137137
files: ["__tests__/**/*", "test.js"],
138138
plugins: ["import-x"],
139139
rules: {
140-
// Forbid: `import x from "./foo"`; require `"./foo.ts"`
141-
"import-x/extensions": [
142-
"error",
143-
"ignorePackages",
144-
{ checkTypeImports: true },
145-
],
146140
"@typescript-eslint/no-explicit-any": 0,
147141
"@typescript-eslint/explicit-function-return-type": 0,
148142
"@typescript-eslint/no-var-requires": 0,
@@ -155,6 +149,7 @@ module.exports = [
155149
{
156150
files: ["perfTest/**/*", "examples/**/*"],
157151
rules: {
152+
"import-x/extensions": "off",
158153
"@typescript-eslint/no-var-requires": 0,
159154
},
160155
},

examples/readme/events.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
const { run, addJobAdhoc } = require(/* "graphile-worker" */ "../..");
1+
const { run, addJobAdhoc } = require(
2+
/* "graphile-worker" */ "../../dist/index.js",
3+
);
24

35
async function main() {
46
// Run a worker to execute jobs:

perfTest/b.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
const a = require("./n").a;
1+
const a = require("./n.js").a;
22
console.log(`perfTest/b.js cyclic check: a is ${a} (expect 3)`);
33
exports.b = a + 2; /* 5 */

perfTest/latencyTest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// @ts-check
22
const assert = require("assert");
33
const { Pool } = require("pg");
4-
const { runTaskList } = require("../dist/main");
5-
const { default: deferred } = require("../dist/deferred");
4+
const { runTaskList } = require("../dist/main.js");
5+
const { default: deferred } = require("../dist/deferred.js");
66
const preset = require("./graphile.config.js");
77

88
/** @type {(ms: number) => Promise<void>} */

perfTest/n.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const a = 3;
22
exports.a = a;
3-
const b = require("./b").b;
3+
const b = require("./b.js").b;
44
const n = a + b; /* 3 + 5 */
55
exports.n = n;
66
console.log(`perfTest/n.js cyclic check: n is ${n} (expect 8)`);

perfTest/tasks/cyclic-require.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { n } = require("../n");
1+
const { n } = require("../n.js");
22

33
module.exports = ({ id }) => {
44
if (id === n) {

website/src/components/Sponsor/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import FallbackAvatar from "@site/static/img/avatar.svg";
44
import clsx from "clsx";
55
import React, { useContext } from "react";
66

7-
import { SponsorContext } from "../../contexts/sponsor";
7+
import { SponsorContext } from "../../contexts/sponsor.js";
88

99
function Avatar({ src }) {
1010
return src ? (

website/src/components/Sponsors/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import styles from "@site/src/components/Sponsors/styles.module.css";
22
import clsx from "clsx";
33
import React from "react";
44

5-
import { SponsorContext } from "../../contexts/sponsor";
5+
import { SponsorContext } from "../../contexts/sponsor.js";
66

77
export default function Sponsors({ children, level }) {
88
return (

website/src/pages/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Layout from "@theme/Layout";
1111
import clsx from "clsx";
1212
import React from "react";
1313

14-
import HomepageTestimonials from "../components/HomepageTestimonials";
14+
import HomepageTestimonials from "../components/HomepageTestimonials/index.js";
1515
import styles from "./index.module.css";
1616

1717
function HomepageHeader() {

0 commit comments

Comments
 (0)