Skip to content

Commit a4df275

Browse files
committed
Update build
1 parent 5da360c commit a4df275

6 files changed

Lines changed: 23 additions & 26 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ jobs:
66

77
build:
88

9+
env:
10+
TSESTREE_SINGLE_RUN: 'false'
11+
912
name: Build
1013

1114
runs-on: ubuntu-latest
@@ -14,7 +17,7 @@ jobs:
1417
- uses: actions/checkout@v4
1518
- uses: actions/setup-node@v4
1619
with:
17-
node-version: ^20.8
20+
node-version: '22'
1821
- run: |
1922
npm install
2023
gulp make-ts-defs
@@ -35,14 +38,14 @@ jobs:
3538

3639
strategy:
3740
matrix:
38-
node-version: ['16.0.0', '16', '18', '20', '21']
41+
node-version: ['16.0.0', '16', '18', '20', '22']
3942

4043
steps:
4144
- uses: actions/checkout@v4
4245
- uses: actions/setup-node@v4
4346
with:
4447
node-version: ${{ matrix.node-version }}
45-
- run: npm install
48+
- run: npm uninstall @origin-1/eslint-config
4649
- uses: actions/download-artifact@v4
4750
with:
4851
name: lib

gulpfile.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ task
101101
{
102102
const
103103
[
104-
{ default: eslintPluginTSTest },
104+
{ processor: tsTestProcessor },
105105
{ createConfig },
106106
{ EslintEnvProcessor },
107107
{ default: globals },
@@ -188,15 +188,15 @@ task
188188
},
189189
{
190190
files: ['**/*.tstest'],
191-
plugins: { tstest: eslintPluginTSTest },
191+
processor: tsTestProcessor,
192192
rules:
193193
{
194194
'@stylistic/spaced-comment': 'off',
195195
'@typescript-eslint/no-extraneous-class': 'off',
196196
'@typescript-eslint/no-misused-new': 'off',
197197
'@typescript-eslint/no-unused-vars': 'off',
198198
'@typescript-eslint/no-useless-constructor': 'off',
199-
'constructor-super': 'off',
199+
'no-duplicate-imports': 'off',
200200
},
201201
},
202202
);

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"ansi-colors": "latest",
4343
"c8js": "latest",
4444
"chai": "4",
45+
"eslint-formatter-compact": "latest",
4546
"eslint-plugin-eslint-env": "latest",
4647
"glob": "latest",
4748
"gulp": "latest",
@@ -101,7 +102,7 @@
101102
"./package.json": "./package.json"
102103
},
103104
"imports": {
104-
"#eslint-plugin-tstest": "./test/eslint-plugin-tstest.js"
105+
"#eslint-plugin-tstest": "./test/eslint-plugin-tstest.mjs"
105106
},
106107
"types": "lib/polytype-module.d.ts"
107108
}

src/polytype-esm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ const _Function_prototype_hasInstance_call = bindCall(_Function_prototype[_Symb
115115
const _Function_prototype_toString_call = bindCall(_Function_prototype.toString);
116116
const _Object_prototype_valueOf_call = bindCall(_Object.prototype.valueOf);
117117

118-
bindCall = null;
118+
bindCall = null; // eslint-disable-line no-useless-assignment
119119
_Function_prototype_call = null;
120120

121121
const checkDuplicateSuperType =
Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
/* eslint-env node */
22

3-
'use strict';
4-
5-
function getImportStatement(polytypeMode)
3+
export function getImportStatement(polytypeMode)
64
{
75
switch (polytypeMode)
86
{
@@ -15,7 +13,7 @@ function getImportStatement(polytypeMode)
1513
}
1614
}
1715

18-
function getTestCase(code)
16+
export function getTestCase(code)
1917
{
2018
const match =
2119
code.match(/(?<=^|\u2028|\u2029)[^\S\r\n\u2028\u2029]?\/\*!TESTDATA\b(?<testData>.*?)\*\//msu);
@@ -70,18 +68,12 @@ function preprocess(text, filename)
7068
return returnValue;
7169
}
7270

73-
function processTestCase({ testData, before, after }, importStatement)
71+
export function processTestCase({ testData, before, after }, importStatement)
7472
{
7573
const processedCode = `${before}${importStatement}/* TESTDATA${testData}*/${after}`;
7674
return processedCode;
7775
}
7876

7977
const fileNameToTestCaseMap = new Map();
8078

81-
module.exports =
82-
{
83-
getImportStatement,
84-
getTestCase,
85-
processTestCase,
86-
processors: { '.tstest': { preprocess, postprocess } },
87-
};
79+
export const processor = { preprocess, postprocess };

test/serve.mjs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,38 @@ import { extname, join } from 'node:path';
99
import { fileURLToPath } from 'node:url';
1010
import ansiColors from 'ansi-colors';
1111

12-
const pathDir = fileURLToPath(new URL('..', import.meta.url));
12+
const baseDir = fileURLToPath(new URL('..', import.meta.url));
1313
const mimeTypes =
1414
{
1515
'.css': 'text/css',
1616
'.html': 'text/html',
1717
'.js': 'application/javascript',
18+
'.json': 'application/json',
1819
'.mjs': 'application/javascript',
1920
};
2021
const port = 8080;
2122
createServer
2223
(
2324
({ url }, response) =>
2425
{
25-
const requestPath = fileURLToPath(new URL(url, 'file:'));
26-
if (requestPath === '/favicon.ico')
26+
const { pathname } = new URL(url, 'file:');
27+
if (pathname === '/favicon.ico')
2728
{
2829
const headers = { 'Content-Type': 'image/x-icon' };
2930
response.writeHead(204, headers);
3031
response.end();
3132
return;
3233
}
33-
const pathname = join(pathDir, requestPath);
34-
const stream = createReadStream(pathname);
34+
const fullPath = join(baseDir, pathname);
35+
const stream = createReadStream(fullPath);
3536
stream.on
3637
(
3738
'open',
3839
() =>
3940
{
4041
const headers = { };
4142
{
42-
const ext = extname(requestPath);
43+
const ext = extname(fullPath);
4344
if (mimeTypes.hasOwnProperty(ext))
4445
headers['Content-Type'] = mimeTypes[ext];
4546
}

0 commit comments

Comments
 (0)