anki/ts/eslint.bzl
Henrik Giesel 30bbbaf00b
Use eslint for sorting our imports (#1637)
* Make eslint sort our imports

* fix missing deps in eslint rule (dae)

Caught on Linux due to the stricter sandboxing

* Remove exports-last eslint rule (for now?)

* Adjust browserslist settings

- We use ResizeObserver which is not supported in browsers like KaiOS,
  Baidu or Android UC

* Raise minimum iOS version 13.4

- It's the first version that supports ResizeObserver

* Apply new eslint rules to sort imports
2022-02-04 18:36:34 +10:00

27 lines
884 B
Python

load("@npm//eslint:index.bzl", _eslint_test = "eslint_test")
def eslint_test(name = "eslint", srcs = None, exclude = []):
if not srcs:
srcs = native.glob([
"**/*.ts",
"**/*.svelte",
], exclude = exclude)
_eslint_test(
name = name,
args = [
"--max-warnings=0",
"-c",
"$(location @ankidesktop//ts:.eslintrc.js)",
] + [native.package_name() + "/" + f for f in srcs],
data = [
"@ankidesktop//ts:.eslintrc.js",
"@ankidesktop//:package.json",
"@npm//@typescript-eslint/parser",
"@npm//@typescript-eslint/eslint-plugin",
"@npm//eslint-plugin-svelte3",
"@npm//eslint-plugin-import",
"@npm//eslint-plugin-simple-import-sort",
"@npm//eslint-plugin-compat",
] + srcs,
)