Skip to content

Commit

Permalink
refactor(config): Minor cleanups in config files (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomByte authored Sep 27, 2024
1 parent 62b9feb commit 9b9ae5a
Show file tree
Hide file tree
Showing 7 changed files with 240 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ end_of_line = lf
indent_size = 4
insert_final_newline = true

[*.{css,html,js,cjs,mjs,jsx,ts,tsx,less,txt,json,yml,md}]
[*.{css,html,js,cjs,mjs,jsx,ts,cts,mts,tsx,less,txt,json,yml,md}]
trim_trailing_whitespace = true
end_of_line = lf
indent_size = 4
Expand Down
15 changes: 4 additions & 11 deletions ava.config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import {satisfies} from "semver";
import process from "node:process";

// Calculate nodeArguments based on the Node version
const nodeArguments = [];
if (satisfies(process.versions.node, "< 18.19.0")) {
nodeArguments.push("--loader=tsx/esm");
nodeArguments.push("--loader=esmock");
} else {
nodeArguments.push("--import=tsx/esm");
}
nodeArguments.push("--no-warnings=ExperimentalWarning");
const nodeArguments = [
"--import=tsx/esm",
"--no-warnings=ExperimentalWarning",
];

export default {
extensions: {
Expand Down
7 changes: 5 additions & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import stylistic from "@stylistic/eslint-plugin";
import ava from "eslint-plugin-ava";

export default tseslint.config(
{
Expand Down Expand Up @@ -33,7 +34,8 @@ export default tseslint.config(
arrowParens: true,
braceStyle: "1tbs",
blockSpacing: false,
}), {
}),
ava.configs["flat/recommended"], {
// Lint all JS files using the eslint parser
files: ["**/*.js"],
languageOptions: {
Expand Down Expand Up @@ -117,10 +119,11 @@ export default tseslint.config(
},
],
"no-implicit-coercion": [
2,
"error",
{allow: ["!!"]},
],
"no-console": "error",
"no-eval": "error",
},
}
);
226 changes: 225 additions & 1 deletion npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@
"ava": "^6.1.3",
"depcheck": "^1.4.7",
"eslint": "^9.11.1",
"eslint-plugin-ava": "^15.0.1",
"esmock": "^2.6.7",
"husky": "^9.1.6",
"licensee": "^11.1.0",
"nyc": "^17.1.0",
"rimraf": "^6.0.1",
"semver": "^7.6.3",
"sinon": "^19.0.2",
"tsx": "^4.19.1",
"typescript-eslint": "^8.7.0",
Expand Down
1 change: 1 addition & 0 deletions test/lib/linter/amdTranspiler/parseModuleDeclaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ test("All combinations", (t) => {
permutations.forEach(({args, expected}) => {
// Omit any parameters with "kind" set to null
const res = _matchArgumentsToParameters(args.filter((_) => _?.kind));
// eslint-disable-next-line ava/assertion-arguments -- https://github.com/avajs/eslint-plugin-ava/issues/332
t.deepEqual(
resolveSyntaxKind(res),
resolveSyntaxKind(expected),
Expand Down
6 changes: 3 additions & 3 deletions test/lib/utils/configManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ test("Check config file", async (t) => {

t.deepEqual(config, {
ignores: [
"!test/sap/m/visual/Magician.spec.js",
"test/**/*",
"webapp/test/**/*",
"!webapp/test/integration/opaTests.qunit.js",
],
}, "The configuration is derived from the provided custom config file");
});
Expand Down Expand Up @@ -51,7 +51,7 @@ test("Resolves to an empty config if default module is not found", async (t) =>
t.deepEqual(config, {}, "An empty configuration gets returned");
});

test.only("Check config file with absolute path", async (t) => {
test("Check config file with absolute path", async (t) => {
const confManager = new ConfigManager(
path.join(fixturesProjectsPath, "com.ui5.troublesome.app"), "ui5lint-custom.config.cjs");

Expand Down

0 comments on commit 9b9ae5a

Please sign in to comment.