Skip to content

Commit 8da5151

Browse files
kevinmlsilvazglicz
authored andcommitted
JS-894 Change configuration for demo and import from fs/* (#5802)
1 parent b46723f commit 8da5151

File tree

7 files changed

+29
-22
lines changed

7 files changed

+29
-22
lines changed

deno.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"tasks": {
3+
"run": "deno run --allow-all --sloppy-imports",
4+
"test": "deno test --allow-all --sloppy-imports",
5+
"check": "deno check --allow-all --sloppy-imports"
6+
}
7+
}

package.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
"build:cov": "mvn clean && npm run bridge:build:cov && npm run _:plugin:prepare-bridge && npm run plugin:build",
1010
"build:fast": "npm run bridge:build:fast && npm run _:plugin:prepare-bridge && npm run plugin:build:fast",
1111
"bf": "npm run build:fast",
12-
"new-rule": "tsx tools/new-rule.mts",
13-
"generate-meta": "tsx tools/generate-meta.ts",
14-
"generate-java-rule-classes": "tsx tools/generate-java-rule-classes.ts",
15-
"ruling": "tsx --tsconfig packages/tsconfig.test.json --test packages/ruling/projects/*.ruling.test.ts",
16-
"ruling-deno": "deno test --allow-all --parallel lib/ruling/projects/",
12+
"new-rule": "deno task run tools/new-rule.mts",
13+
"generate-meta": "deno task run tools/generate-meta.ts",
14+
"generate-java-rule-classes": "deno task run tools/generate-java-rule-classes.ts",
15+
"ruling": "deno task run --tsconfig packages/tsconfig.test.json --test packages/ruling/projects/*.ruling.test.ts",
16+
"ruling-deno": "deno task test --parallel lib/ruling/projects/",
1717
"ruling-sync": "rsync -avh packages/ruling/actual/jsts/ its/ruling/src/test/expected/jsts/ --delete",
1818
"bridge:compile:ts5": "tsc -b packages && npm run _:bridge:copy-protofiles",
1919
"bridge:compile": "tsgo -p packages/tsconfig.app.json && tsgo -p packages/tsconfig.test.json && npm run _:bridge:copy-protofiles",
20-
"bridge:test": "tsx --tsconfig packages/tsconfig.test.json --test --test-concurrency=4 --test-reporter=spec --test-reporter-destination stdout \"packages/*/src/rules/*[!node_modules]/**/*.test.ts\" \"packages/**/tests/**/*.test.ts\"",
21-
"bridge:test:js": "tsx tools/copy-test-resources.ts && node --test --enable-source-maps --test-concurrency=4 --test-reporter=spec --test-reporter-destination stdout \"lib/*/src/rules/*[!node_modules]/**/*.test.js\" \"lib/**/tests/**/*.test.js\"",
20+
"bridge:test": "deno task test --tsconfig packages/tsconfig.test.json --test-concurrency=4 --test-reporter=spec --test-reporter-destination stdout \"packages/*/src/rules/*[!node_modules]/**/*.test.ts\" \"packages/**/tests/**/*.test.ts\"",
21+
"bridge:test:js": "deno task run tools/copy-test-resources.ts && node --test --enable-source-maps --test-concurrency=4 --test-reporter=spec --test-reporter-destination stdout \"lib/*/src/rules/*[!node_modules]/**/*.test.js\" \"lib/**/tests/**/*.test.js\"",
2222
"bridge:test:cov": "cross-env 'NODE_OPTIONS=--import ./tools/nyc-esm-hook-loader.js' nyc npm run bridge:test:js",
2323
"bridge:bundle": "node esbuild.mjs",
2424
"bridge:build": "npm run bridge:build:fast && npm run bridge:test",
@@ -32,7 +32,7 @@
3232
"prepare": "husky",
3333
"precommit": "pretty-quick --staged",
3434
"postinstall": "patch-package",
35-
"count-rules": "tsx tools/count-rules.ts",
35+
"count-rules": "deno task run tools/count-rules.ts",
3636
"_:bridge:copy-protofiles": "cpy --flat packages/jsts/src/parsers/estree.proto lib/jsts/src/parsers",
3737
"_:bridge:clear": "rimraf --glob lib/*",
3838
"_:plugin:prepare-bridge": "npm run bridge:bundle && npm pack --ignore-scripts && npm run _:plugin:copy-bridge",
@@ -44,8 +44,8 @@
4444
"eslint-plugin:types": "tsc -p tsconfig-plugin.json --declaration true --emitDeclarationOnly --outDir lib/types",
4545
"eslint-plugin:package-json": "node generate-eslint-package-json.mjs",
4646
"eslint-plugin:copy-assets": "cpy LICENSE.txt lib/ --rename LICENSE && cpy packages/jsts/src/rules/README.md lib/ --flat",
47-
"eslint-docs": "rimraf --glob lib/docs/*.md && eslint-doc-generator lib --init-rule-docs && tsx tools/generate-external-rules-docs.ts",
48-
"deploy-rule-data": "tsx tools/deploy-rule-data.ts",
47+
"eslint-docs": "rimraf --glob lib/docs/*.md && eslint-doc-generator lib --init-rule-docs && deno task run tools/generate-external-rules-docs.ts",
48+
"deploy-rule-data": "deno task run tools/deploy-rule-data.ts",
4949
"license-regeneration": "node license-management.mjs"
5050
},
5151
"repository": {
@@ -96,7 +96,6 @@
9696
"prettier-plugin-java": "2.7.5",
9797
"pretty-quick": "4.2.2",
9898
"rimraf": "6.0.1",
99-
"tsx": "4.20.6",
10099
"type-fest": "5.0.1",
101100
"typedoc": "0.28.13"
102101
},

tools/create-rule-boilerplate.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515
* along with this program; if not, see https://sonarsource.com/license/ssal/
1616
*/
1717

18+
import { mkdir, writeFile } from 'node:fs/promises';
1819
import { join } from 'node:path/posix';
19-
import { header, inflateTemplateToFile, RULES_FOLDER, TS_TEMPLATES_FOLDER } from './helpers.js';
20-
import { mkdir } from 'node:fs/promises';
21-
import { writeFile } from 'fs/promises';
2220
import { generateMetaForRule } from './generate-eslint-meta.js';
2321
import { generateJavaCheckClass } from './generate-java-rule-classes.js';
2422
import { updateIndexes } from './generate-rule-indexes.js';
23+
import { header, inflateTemplateToFile, RULES_FOLDER, TS_TEMPLATES_FOLDER } from './helpers.js';
2524

2625
const JS_RULE_DATA_FOLDER = join(
2726
'sonar-plugin',

tools/generate-eslint-meta.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* along with this program; if not, see https://sonarsource.com/license/ssal/
1616
*/
1717

18+
import { readFile } from 'node:fs/promises';
1819
import { join } from 'node:path/posix';
1920
import { defaultOptions } from '../packages/jsts/src/rules/helpers/configs.js';
2021
import {
@@ -27,7 +28,6 @@ import {
2728
TS_TEMPLATES_FOLDER,
2829
typeMatrix,
2930
} from './helpers.js';
30-
import { readFile } from 'fs/promises';
3131

3232
const sonarWayProfile = JSON.parse(
3333
await readFile(join(METADATA_FOLDER, `Sonar_way_profile.json`), 'utf-8'),

tools/helpers.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@
1414
* You should have received a copy of the Sonar Source-Available License
1515
* along with this program; if not, see https://sonarsource.com/license/ssal/
1616
*/
17-
import prettier from 'prettier';
18-
import { readdir, readFile, stat, writeFile } from 'fs/promises';
17+
import { readdir, readFile, stat, writeFile } from 'node:fs/promises';
1918
import { dirname, join } from 'node:path';
2019
import { fileURLToPath, pathToFileURL } from 'node:url';
20+
import prettier from 'prettier';
2121
//@ts-ignore
22-
import { prettier as prettierOpts } from '../package.json';
23-
import { ESLintConfiguration } from '../packages/jsts/src/rules/helpers/configs.js';
2422
import { mkdir } from 'node:fs/promises';
2523
import prettierPluginJava from 'prettier-plugin-java';
24+
import packageJson from '../package.json' with { type: 'json' };
25+
import { ESLintConfiguration } from '../packages/jsts/src/rules/helpers/configs.js';
26+
27+
const { prettier: prettierOpts } = packageJson;
2628

2729
export const ruleRegex = /^S\d+/;
2830
const DIRNAME = dirname(fileURLToPath(import.meta.url));

tools/new-plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
* along with this program; if not, see https://sonarsource.com/license/ssal/
1616
*/
1717

18+
import { readFile } from 'node:fs/promises';
1819
import { resolve } from 'node:path/posix';
1920
import { createNewRule } from './create-rule-boilerplate.js';
20-
import { readFile } from 'fs/promises';
2121

2222
type RuleConfig = {
2323
name: string;

tools/sync-nodejs-versions.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
* along with this program; if not, see https://sonarsource.com/license/ssal/
1616
*/
1717

18-
import fs from 'fs/promises';
19-
import semver from 'semver';
18+
import fs from 'node:fs/promises';
2019
import path from 'node:path/posix';
20+
import semver from 'semver';
2121

2222
const dirs = process.argv[2]
2323
? [process.argv[2]]

0 commit comments

Comments
 (0)