Skip to content

Commit 74a8ac6

Browse files
build: remove eslint 8 build
BREAKING CHANGE: eslint 8 support removed
1 parent 4558b4a commit 74a8ac6

File tree

6 files changed

+35
-200
lines changed

6 files changed

+35
-200
lines changed

package.json

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,13 @@
3434
"Jonas Kello"
3535
],
3636
"exports": {
37-
".": {
38-
"types": {
39-
"import": "./lib/classic.d.mts",
40-
"require": "./lib/classic.d.cts"
41-
},
42-
"import": "./lib/classic.mjs",
43-
"require": "./lib/classic.cjs"
37+
"types": {
38+
"require": "./lib/index.d.cts",
39+
"import": "./lib/index.d.mts"
4440
},
45-
"./flat": {
46-
"types": {
47-
"import": "./lib/flat.d.mts",
48-
"require": "./lib/flat.d.cts"
49-
},
50-
"import": "./lib/flat.mjs",
51-
"require": "./lib/flat.cjs"
52-
}
41+
"require": "./lib/index.cjs",
42+
"import": "./lib/index.mjs"
5343
},
54-
"main": "lib/classic.cjs",
55-
"types": "lib/classic.d.cts",
5644
"files": [
5745
"lib/",
5846
"package.json",

rollup.config.ts

Lines changed: 22 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { rollupPlugin as rollupPluginDeassert } from "deassert";
2-
import { type RollupOptions } from "rollup";
2+
import { type OutputOptions, type RollupOptions } from "rollup";
33
import rollupPluginAutoExternal from "rollup-plugin-auto-external";
44
import rollupPluginTs from "rollup-plugin-ts";
55

@@ -12,16 +12,15 @@ const treeshake = {
1212
unknownGlobalSideEffects: false,
1313
} satisfies RollupOptions["treeshake"];
1414

15-
const classicCJS = {
16-
input: "src/classic.ts",
17-
18-
output: {
19-
file: pkg.exports["."].require,
20-
format: "cjs",
21-
sourcemap: false,
15+
const output = {
16+
sourcemap: false,
17+
generatedCode: {
18+
preset: "es2015",
2219
},
20+
} satisfies Omit<OutputOptions, "file">;
2321

24-
plugins: [
22+
function getPlugins(format: "esm" | "cjs"): RollupOptions["plugins"] {
23+
return [
2524
rollupPluginAutoExternal(),
2625
rollupPluginTs({
2726
transpileOnly: true,
@@ -32,7 +31,7 @@ const classicCJS = {
3231
paths: {
3332
...resolvedConfig.paths,
3433
"#eslint-plugin-functional/conditional-imports/*": [
35-
"src/utils/conditional-imports/cjs/*",
34+
`src/utils/conditional-imports/${format}/*`,
3635
],
3736
},
3837
}),
@@ -41,111 +40,35 @@ const classicCJS = {
4140
rollupPluginDeassert({
4241
include: ["**/*.{js,ts}"],
4342
}),
44-
],
43+
];
44+
}
4545

46-
treeshake,
47-
} satisfies RollupOptions;
48-
49-
const classicESM = {
50-
input: "src/classic.ts",
46+
const esm = {
47+
input: "src/index.ts",
5148

5249
output: {
53-
file: pkg.exports["."].import,
50+
...output,
51+
file: pkg.exports.import,
5452
format: "esm",
55-
sourcemap: false,
5653
},
5754

58-
plugins: [
59-
rollupPluginAutoExternal(),
60-
rollupPluginTs({
61-
transpileOnly: true,
62-
tsconfig: {
63-
fileName: "tsconfig.build.json",
64-
hook: (resolvedConfig) => ({
65-
...resolvedConfig,
66-
paths: {
67-
...resolvedConfig.paths,
68-
"#eslint-plugin-functional/conditional-imports/*": [
69-
"src/utils/conditional-imports/esm/*",
70-
],
71-
},
72-
}),
73-
},
74-
}),
75-
rollupPluginDeassert({
76-
include: ["**/*.{js,ts}"],
77-
}),
78-
],
55+
plugins: getPlugins("esm"),
7956

8057
treeshake,
8158
} satisfies RollupOptions;
8259

83-
const flatCJS = {
84-
input: "src/flat.ts",
60+
const cjs = {
61+
input: "src/index.ts",
8562

8663
output: {
87-
file: pkg.exports["./flat"].require,
64+
...output,
65+
file: pkg.exports.require,
8866
format: "cjs",
89-
sourcemap: false,
9067
},
9168

92-
plugins: [
93-
rollupPluginAutoExternal(),
94-
rollupPluginTs({
95-
transpileOnly: true,
96-
tsconfig: {
97-
fileName: "tsconfig.build.json",
98-
hook: (resolvedConfig) => ({
99-
...resolvedConfig,
100-
paths: {
101-
...resolvedConfig.paths,
102-
"#eslint-plugin-functional/conditional-imports/*": [
103-
"src/utils/conditional-imports/cjs/*",
104-
],
105-
},
106-
}),
107-
},
108-
}),
109-
rollupPluginDeassert({
110-
include: ["**/*.{js,ts}"],
111-
}),
112-
],
113-
114-
treeshake,
115-
} satisfies RollupOptions;
116-
117-
const flatESM = {
118-
input: "src/flat.ts",
119-
120-
output: {
121-
file: pkg.exports["./flat"].import,
122-
format: "esm",
123-
sourcemap: false,
124-
},
125-
126-
plugins: [
127-
rollupPluginAutoExternal(),
128-
rollupPluginTs({
129-
transpileOnly: true,
130-
tsconfig: {
131-
fileName: "tsconfig.build.json",
132-
hook: (resolvedConfig) => ({
133-
...resolvedConfig,
134-
paths: {
135-
...resolvedConfig.paths,
136-
"#eslint-plugin-functional/conditional-imports/*": [
137-
"src/utils/conditional-imports/esm/*",
138-
],
139-
},
140-
}),
141-
},
142-
}),
143-
rollupPluginDeassert({
144-
include: ["**/*.{js,ts}"],
145-
}),
146-
],
69+
plugins: getPlugins("cjs"),
14770

14871
treeshake,
14972
} satisfies RollupOptions;
15073

151-
export default [classicCJS, classicESM, flatCJS, flatESM];
74+
export default [cjs, esm];

src/classic.ts

Lines changed: 0 additions & 47 deletions
This file was deleted.
File renamed without changes.

tests/index.test.ts

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,49 +6,21 @@ import { readdirSync } from "node:fs";
66

77
import { describe, expect, it } from "vitest";
88

9-
import classic from "#eslint-plugin-functional/classic";
10-
import flat from "#eslint-plugin-functional/flat";
9+
import functional from "#eslint-plugin-functional";
1110

12-
describe("Flat", () => {
11+
describe("index", () => {
1312
it("should have all the rules", () => {
1413
const ruleFiles: string[] = readdirSync("./src/rules").filter(
1514
(file) => file !== "index.ts" && file.endsWith(".ts"),
1615
);
1716

1817
expect(
19-
Object.hasOwn(flat, "rules"),
18+
Object.hasOwn(functional, "rules"),
2019
'The plugin\'s config object should have a "rules" property.',
2120
);
22-
expect(ruleFiles.length).to.equal(Object.keys(flat.rules ?? {}).length);
23-
});
24-
25-
it("should have all the configs", () => {
26-
const configFiles: string[] = readdirSync("./src/configs").filter(
27-
(file) => file !== "index.ts" && file.endsWith(".ts"),
28-
);
29-
30-
expect(
31-
Object.hasOwn(flat, "configs"),
32-
'The plugin\'s config object should have a "configs" property.',
33-
);
34-
expect(configFiles.length).to.equal(
35-
Object.keys(flat.configs ?? {}).length,
36-
"should have all the configs except deprecated",
37-
);
38-
});
39-
});
40-
41-
describe("Classic", () => {
42-
it("should have all the rules", () => {
43-
const ruleFiles: string[] = readdirSync("./src/rules").filter(
44-
(file) => file !== "index.ts" && file.endsWith(".ts"),
45-
);
46-
47-
expect(
48-
Object.hasOwn(classic, "rules"),
49-
'The plugin\'s config object should have a "rules" property.',
21+
expect(ruleFiles.length).to.equal(
22+
Object.keys(functional.rules ?? {}).length,
5023
);
51-
expect(ruleFiles.length).to.equal(Object.keys(classic.rules ?? {}).length);
5224
});
5325

5426
it("should have all the configs", () => {
@@ -57,11 +29,11 @@ describe("Classic", () => {
5729
);
5830

5931
expect(
60-
Object.hasOwn(classic, "configs"),
32+
Object.hasOwn(functional, "configs"),
6133
'The plugin\'s config object should have a "configs" property.',
6234
);
6335
expect(configFiles.length).to.equal(
64-
Object.keys(classic.configs ?? {}).length,
36+
Object.keys(functional.configs ?? {}).length,
6537
"should have all the configs except deprecated",
6638
);
6739
});

tsconfig.base.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
"types": ["vitest/importMeta"],
3232
"baseUrl": ".",
3333
"paths": {
34-
"#eslint-plugin-functional/flat": ["src/flat.ts"],
35-
"#eslint-plugin-functional/classic": ["src/classic.ts"],
34+
"#eslint-plugin-functional": ["src/index.ts"],
3635
"#eslint-plugin-functional/configs/*": ["src/configs/*"],
3736
"#eslint-plugin-functional/options": ["src/options"],
3837
"#eslint-plugin-functional/rules": ["src/rules"],

0 commit comments

Comments
 (0)