Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .eslintignore

This file was deleted.

82 changes: 0 additions & 82 deletions .eslintrc.js

This file was deleted.

3 changes: 1 addition & 2 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ nodejs_binary(
nodejs_binary(
name = "eslint",
data = [
".eslintrc.js",
".eslintignore",
"eslint.config.js",
"@npm//@typescript-eslint/parser",
"@npm//eslint",
] + glob(["eslint-rules/**"]),
Expand Down
116 changes: 116 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/**
* ESLint flat config for the Dataform repository.
*/
const rawTsParser = require("@typescript-eslint/parser");
const noNodeBuiltins = require("./eslint-rules/no-node-builtins");
const orderedImports = require("./eslint-rules/ordered-imports");

// Compatibility shim for @typescript-eslint/parser v5 with ESLint v10
// This should be removed when @typescript-eslint/parser is updated (which would require updating typescript)
const tsParser = {
...rawTsParser,
parseForESLint(code, options) {
const result = rawTsParser.parseForESLint(code, options);
if (result.scopeManager && !result.scopeManager.addGlobals) {
result.scopeManager.addGlobals = names => {
for (const name of names) {
if (!result.scopeManager.globalScope.set.has(name)) {
result.scopeManager.globalScope.defineImplicitVariable(name, {
isTypeVariable: false,
isValueVariable: true
});
}
}
};
}
return result;
}
};

module.exports = [
{
ignores: [
"node_modules/**",
"bazel-*/**",
"dist/**",
"tmp/**",
"tests/api/projects/**",
"tests/integration/*_project/**"
]
},
{
files: ["**/*.ts"],
languageOptions: {
parser: tsParser,
ecmaVersion: 2020,
sourceType: "module"
},
plugins: {
local: {
rules: {
"no-node-builtins": noNodeBuiltins,
"ordered-imports": orderedImports
}
}
},
rules: {
"prefer-const": "error",
"no-var": "error",
"no-debugger": "error",
"no-duplicate-imports": "error",
"no-empty": ["error", { allowEmptyCatch: true }],
curly: "error",
eqeqeq: ["error", "smart"],
"no-unused-expressions": "error",
"no-console": "error",
"no-eval": "error",
"no-throw-literal": "error",
radix: "error",
"no-cond-assign": "error",
"no-unsafe-finally": "error",
"no-caller": "error",
"use-isnan": "error",
"no-self-assign": "error",
"no-shadow-restricted-names": "error",
"local/ordered-imports": "error",
"no-new-func": "error"
}
},
{
// JIT compiler dynamically creates executable functions in the V8 sandbox
files: ["core/jit_compiler.ts"],
rules: {
"no-new-func": "off"
}
},
{
// core/ runs inside the V8 compilation sandbox — no Node built-ins.
files: ["core/**/*.ts"],
rules: {
"local/no-node-builtins": "error"
}
},
{
// Ambient declarations for webpack internals
files: ["core/utils.ts", "core/workflow_settings.ts"],
rules: {
"no-var": "off"
}
},
{
// Tests, testing helpers, examples, CLI console wrapper, VSCode extension, and common promises logger may use console
files: [
"**/*_test.ts",
"**/*.test.ts",
"testing/**/*.ts",
"examples/**/*.ts",
"cli/console.ts",
"vscode/**/*.ts",
"common/promises/index.ts"
],
rules: {
"local/no-node-builtins": "off",
"no-console": "off"
}
}
];
18 changes: 12 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@
"@types/moo": "^0.5.0",
"@types/node": "^16.16.0",
"@types/readline-sync": "^1.4.3",
"@types/rimraf": "^2.0.2",
"@types/semver": "^7.3.13",
"@types/tmp": "^0.2.0",
"@types/vscode": "^1.45.1",
"@types/yargs": "^15.0.5",
"@typescript-eslint/parser": "^5.62.0",
"@vscode/vsce": "3.9.3-7",
"chai": "^4.2.0",
"chalk": "^4.0.0",
"chokidar": "^3.5.3",
"deepmerge": "^4.2.2",
"diff": "^8.0.3",
"escodegen": "^1.13.0",
"eslint": "^8.57.0",
"eslint": "^10.9.1",
"espree": "^7.0.0",
"estraverse": "^5.1.0",
"fs-extra": "^9.0.0",
"glob": "13.0.6",
"google-sql-syntax-ts": "^1.0.3",
"js-beautify": "^1.10.2",
"js-beautify": "^1.15.4",
"js-yaml": "^4.3.2",
"jsdoc": "^4.0.5",
"json-stable-stringify": "^1.0.1",
Expand All @@ -53,7 +53,6 @@
"protobufjs": "^7.6.5",
"protobufjs-cli": "^1.3.3",
"readline-sync": "^1.4.9",
"rimraf": "^2.6.2",
"rollup": "^2.80.0",
"rollup-plugin-dts": "^1.4.0",
"semver": "^7.5.2",
Expand All @@ -69,7 +68,6 @@
"untildify": "^4.0.0",
"url": "^0.11.0",
"vm2": "3.11.6",
"vsce": "^1.79.5",
"vscode-jsonrpc": "^5.0.1",
"vscode-languageclient": "^6.1.3",
"vscode-languageserver": "^6.1.1",
Expand Down Expand Up @@ -99,6 +97,14 @@
"**/wrap-ansi": "7.0.0",
"**/string-width": "4.1.0",
"**/@eslint-community/eslint-utils": "4.9.1",
"**/@ungap/structured-clone": "1.3.1"
"**/@ungap/structured-clone": "1.3.1",
"**/@azure/identity": "4.13.0",
"**/@azure/abort-controller": "2.1.3-alpha.20260306.4",
"**/@azure/core-auth": "1.10.2-alpha.20260305.6",
"**/@azure/core-client": "1.10.2",
"**/@azure/core-rest-pipeline": "1.24.0",
"**/@azure/core-tracing": "1.3.2-alpha.20260311.2",
"**/@azure/core-util": "1.13.2-alpha.20260311.2",
"**/@azure/logger": "1.3.1-alpha.20260306.4"
}
}
2 changes: 1 addition & 1 deletion scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e
bazel run @nodejs//:yarn -- --frozen-lockfile

# Run eslint.
bazel build @npm//eslint/bin:eslint && bazel-bin/external/npm/eslint/bin/eslint.sh --rulesdir eslint-rules '**/*.ts'
bazel build @npm//eslint/bin:eslint && bazel-bin/external/npm/eslint/bin/eslint.sh '**/*.ts'

# Run prettier on .ts files changed since the branching point
BASE_REF=$(git rev-parse --verify --quiet upstream/main || echo origin/main)
Expand Down
2 changes: 1 addition & 1 deletion scripts/run_integration_tests
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e
bazel run @nodejs//:yarn -- --frozen-lockfile

# Run eslint.
bazel build @npm//eslint/bin:eslint && bazel-bin/external/npm/eslint/bin/eslint.sh --rulesdir eslint-rules '**/*.ts'
bazel build @npm//eslint/bin:eslint && bazel-bin/external/npm/eslint/bin/eslint.sh '**/*.ts'

# Run integration tests
bazel test ... \
Expand Down
2 changes: 1 addition & 1 deletion scripts/run_tests
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e
bazel run @nodejs//:yarn -- --frozen-lockfile

# Run eslint.
bazel build @npm//eslint/bin:eslint && bazel-bin/external/npm/eslint/bin/eslint.sh --rulesdir eslint-rules '**/*.ts'
bazel build @npm//eslint/bin:eslint && bazel-bin/external/npm/eslint/bin/eslint.sh '**/*.ts'

# Run unit tests
bazel test ... \
Expand Down
2 changes: 0 additions & 2 deletions testing/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@ ts_library(
"@npm//@types/js-yaml",
"@npm//@types/json-stable-stringify",
"@npm//@types/node",
"@npm//@types/rimraf",
"@npm//chalk",
"@npm//diff",
"@npm//fs-extra",
"@npm//js-yaml",
"@npm//json-stable-stringify",
"@npm//rimraf",
],
)

Expand Down
5 changes: 2 additions & 3 deletions testing/fixtures.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as fs from "fs";
import * as path from "path";
import * as rimraf from "rimraf";

import { IHookHandler } from "df/testing";

Expand All @@ -19,7 +18,7 @@ export class TmpDirFixture {
public createNewTmpDir() {
// TEST_TMPDIR is set by bazel.
const tmpDirPath = path.resolve(
path.join(process.env.TEST_TMPDIR, `tmp_dir_${TmpDirFixture.dirCounter++}`)
path.join(process.env.TEST_TMPDIR, `tmp_dir_${TmpDirFixture.dirCounter++}`),
);
fs.mkdirSync(tmpDirPath);
this.tmpDirPaths.add(tmpDirPath);
Expand All @@ -28,7 +27,7 @@ export class TmpDirFixture {

private rmTmpDirs() {
for (const tmpPath of this.tmpDirPaths) {
rimraf.sync(tmpPath);
fs.rmSync(tmpPath, { recursive: true, force: true });
}
}
}
1 change: 0 additions & 1 deletion tests/api/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ ts_test_suite(
"@npm//@types/node",
"@npm//chai",
"@npm//fs-extra",
"@npm//rimraf",
"@npm//ts-mockito",
],
)
Loading
Loading