Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jtatasciore/lint #1910

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
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
3 changes: 3 additions & 0 deletions .aspect/cli/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ configure:
go: false
kotlin: false
protobuf: true
lint:
aspects:
- //tools/lint:linters.bzl%eslint
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# @generated
# Input hashes for repository rule npm_translate_lock(name = "npm", pnpm_lock = "@//:pnpm-lock.yaml").
# Input hashes for repository rule npm_translate_lock(name = "npm", pnpm_lock = "@@//:pnpm-lock.yaml").
# This file should be checked into version control along with the pnpm-lock.yaml file.
.npmrc=-2065072158
examples/js_binary/package.json=-41174383
Expand Down Expand Up @@ -27,6 +27,6 @@ npm/private/test/package.json=600650131
npm/private/test/vendored/is-odd/package.json=1041695223
npm/private/test/vendored/lodash-4.17.21.tgz=-1206623349
npm/private/test/vendored/semver-max/package.json=578664053
package.json=-275319675
pnpm-lock.yaml=1584807079
package.json=-1383527523
pnpm-lock.yaml=-203099915
pnpm-workspace.yaml=-762451270
42 changes: 42 additions & 0 deletions .aspect/workflows/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ workspaces:
- --config=aspect_rbe
- format:
without: true
- lint:
without: true
- buildifier:
without: true
- configure:
Expand All @@ -34,6 +36,8 @@ workspaces:
- --config=aspect_rbe
- format:
without: true
- lint:
without: true
- buildifier:
without: true
- configure:
Expand All @@ -53,6 +57,8 @@ workspaces:
- --config=aspect_rbe
- format:
without: true
- lint:
without: true
- buildifier:
without: true
- configure:
Expand All @@ -68,6 +74,8 @@ workspaces:
queue: aspect-medium
- format:
without: true
- lint:
without: true
- buildifier:
without: true
- configure:
Expand All @@ -81,6 +89,8 @@ workspaces:
queue: aspect-medium
- format:
without: true
- lint:
without: true
- buildifier:
without: true
- configure:
Expand All @@ -97,6 +107,8 @@ workspaces:
- --config=aspect_rbe
- format:
without: true
- lint:
without: true
- buildifier:
without: true
- configure:
Expand All @@ -113,6 +125,8 @@ workspaces:
- --config=aspect_rbe
- format:
without: true
- lint:
without: true
- buildifier:
without: true
- configure:
Expand All @@ -129,6 +143,8 @@ workspaces:
- --config=aspect_rbe
- format:
without: true
- lint:
without: true
- buildifier:
without: true
- configure:
Expand All @@ -142,6 +158,8 @@ workspaces:
queue: aspect-medium
- format:
without: true
- lint:
without: true
- buildifier:
without: true
- configure:
Expand All @@ -155,6 +173,8 @@ workspaces:
queue: aspect-medium
- format:
without: true
- lint:
without: true
- buildifier:
without: true
- configure:
Expand All @@ -168,6 +188,8 @@ workspaces:
queue: aspect-medium
- format:
without: true
- lint:
without: true
- buildifier:
without: true
- configure:
Expand All @@ -185,6 +207,8 @@ workspaces:
queue: aspect-medium
- format:
without: true
- lint:
without: true
- buildifier:
without: true
- configure:
Expand All @@ -198,6 +222,8 @@ workspaces:
queue: aspect-medium
- format:
without: true
- lint:
without: true
- buildifier:
without: true
- configure:
Expand All @@ -211,6 +237,8 @@ workspaces:
queue: aspect-medium
- format:
without: true
- lint:
without: true
- buildifier:
without: true
- configure:
Expand All @@ -227,6 +255,8 @@ workspaces:
- --config=aspect_rbe
- format:
without: true
- lint:
without: true
- buildifier:
without: true
- configure:
Expand All @@ -243,6 +273,8 @@ workspaces:
- --config=aspect_rbe
- format:
without: true
- lint:
without: true
- buildifier:
without: true
- configure:
Expand All @@ -259,6 +291,8 @@ workspaces:
- --config=aspect_rbe
- format:
without: true
- lint:
without: true
- buildifier:
without: true
- configure:
Expand All @@ -275,6 +309,8 @@ workspaces:
- --config=aspect_rbe
- format:
without: true
- lint:
without: true
- buildifier:
without: true
- configure:
Expand All @@ -291,6 +327,8 @@ workspaces:
- --config=aspect_rbe
- format:
without: true
- lint:
without: true
- buildifier:
without: true
- configure:
Expand All @@ -304,6 +342,8 @@ workspaces:
queue: aspect-medium
- format:
without: true
- lint:
without: true
- buildifier:
without: true
- configure:
Expand All @@ -327,6 +367,8 @@ tasks:
- build_event_log.bin
- format:
queue: aspect-medium
- lint:
queue: aspect-medium
- buildifier:
queue: aspect-medium
- configure:
Expand Down
4 changes: 2 additions & 2 deletions .bazeliskrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
BAZELISK_BASE_URL=https://github.com/aspect-build/aspect-cli/releases/download
USE_BAZEL_VERSION=aspect/5.9.25
BAZELISK_BASE_URL=https://static.aspect.build/aspect
USE_BAZEL_VERSION=aspect/2024.33.63
4 changes: 0 additions & 4 deletions .prettierrc

This file was deleted.

8 changes: 8 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* eslint-env node */

module.exports = {
trailingComma: 'es5',
tabWidth: 4,
semi: false,
singleQuote: true,
};
18 changes: 18 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,21 @@ alias(
name = "format",
actual = "//tools:format",
)

js_library(
name = "eslintrc",
srcs = ["eslint.config.mjs"],
visibility = ["//visibility:public"],
deps = [
"//:node_modules/@eslint/js",
"//:node_modules/eslint-plugin-simple-import-sort",
"//:node_modules/eslint-plugin-unused-imports",
"//:node_modules/globals",
],
)

js_library(
name = "prettierrc",
srcs = [".prettierrc.cjs"],
visibility = ["//visibility:public"],
)
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ use_repo(bazel_lib_toolchains, "bsd_tar_toolchains")

####### Dev dependencies ########

bazel_dep(name = "aspect_rules_lint", version = "0.12.0", dev_dependency = True)
bazel_dep(name = "aspect_rules_lint", version = "1.0.0-rc9", dev_dependency = True)
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.5.0", dev_dependency = True)
bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)
bazel_dep(name = "gazelle", version = "0.36.0", dev_dependency = True, repo_name = "bazel_gazelle")
Expand Down
10 changes: 5 additions & 5 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,12 @@ load("@buildifier_prebuilt//:defs.bzl", "buildifier_prebuilt_register_toolchains
buildifier_prebuilt_register_toolchains()

# rules_lint
load(
"@aspect_rules_lint//format:repositories.bzl",
"fetch_shfmt",
)
# load(
# "@aspect_rules_lint//format:repositories.bzl",
# "fetch_shfmt",
# )

fetch_shfmt()
# fetch_shfmt()

load("@com_grail_bazel_toolchain//toolchain:deps.bzl", "bazel_toolchain_dependencies")

Expand Down
8 changes: 0 additions & 8 deletions WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# rules_lint
load(
"@aspect_rules_lint//format:repositories.bzl",
"fetch_shfmt",
)

fetch_shfmt()

# dev dependency
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

Expand Down
28 changes: 28 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import js from "@eslint/js";
import simpleImportSort from 'eslint-plugin-simple-import-sort';
import unusedImports from 'eslint-plugin-unused-imports';
import globals from 'globals';

export default [
js.configs.recommended,
// Awkward setup; see https://github.com/facebook/react/issues/28313
{
plugins: {
'simple-import-sort': simpleImportSort,
'unused-imports': unusedImports,
},
rules: {
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
'unused-imports/no-unused-imports': 'error',
},
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
globals: {
...globals.browser,
...globals.node,
},
},
},
];
1 change: 1 addition & 0 deletions foo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
13 changes: 10 additions & 3 deletions js/private/dev_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,18 @@ def rules_js_dev_dependencies():
urls = ["http://github.com/keith/buildifier-prebuilt/archive/6.4.0.tar.gz"],
)

# http_archive(
# name = "aspect_rules_lint",
# sha256 = "6e32df708b40ea8c6d4482eeaf8fd6afaa8798d0028654ba25b667b5aee5707c",
# strip_prefix = "rules_lint-0.7.0",
# url = "https://github.com/aspect-build/rules_lint/releases/download/v0.7.0/rules_lint-v0.7.0.tar.gz",
# )

http_archive(
name = "aspect_rules_lint",
sha256 = "6e32df708b40ea8c6d4482eeaf8fd6afaa8798d0028654ba25b667b5aee5707c",
strip_prefix = "rules_lint-0.7.0",
url = "https://github.com/aspect-build/rules_lint/releases/download/v0.7.0/rules_lint-v0.7.0.tar.gz",
sha256 = "2f6ddca7a15bd6612f70d465fc68f6e1452436b57f4b6b98693c5828f2d6dffd",
strip_prefix = "rules_lint-1.0.0-rc9",
url = "https://github.com/aspect-build/rules_lint/releases/download/v1.0.0-rc9/rules_lint-v1.0.0-rc9.tar.gz",
)

http_archive(
Expand Down
2 changes: 1 addition & 1 deletion js/private/test/data/test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const dataPath = process.argv[2] || './data.json'

const { answer } = require(dataPath)
let { answer } = require(dataPath)

if (answer !== 42) {
throw new Error(`The answer (${answer}) is not 42!`)
Expand Down
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
{
"private": true,
"devDependencies": {
"@eslint/js": "8.57.0",
"@types/node": "16.18.11",
"chalk": "5.1.1",
"eslint": "8.57.0",
"prettier": "3.3.3",
"prettier-plugin-sh": "0.14.0",
"eslint-plugin-simple-import-sort": "12.1.1",
"eslint-plugin-unused-imports": "4.1.3",
"globals": "15.9.0",
"inline-fixtures": "1.1.0",
"jsonpath-plus": "7.2.0",
"typescript": "4.9.5"
Expand Down
Loading
Loading