Skip to content

Force bundler to use ESM, Integrate naming-convention rule, Fix Dependabot Issue #31

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

Merged
merged 4 commits into from
Jul 12, 2024
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Update @minecraft/math pre-bundled output to be ES modules based",
"packageName": "@minecraft/math",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Integrate naming convention rule and force bundler to use ESM by adjusting TSConfig",
"packageName": "eslint-plugin-minecraft-linting",
"email": "[email protected]",
"dependentChangeType": "none"
}
393 changes: 217 additions & 176 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tools/eslint-config-minecraft-scripting/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default [
'unicorn/no-null': ['error', { checkStrictEquality: true }],
'@typescript-eslint/no-empty-function': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/naming-convention': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }],
'@typescript-eslint/no-unused-vars': [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function isApiRecommendation(recommendation: ScriptRecommendation): recommendati

// function is

const ScriptRecommendations: Map<string, ApiScriptRecommendation | ClassScriptRecommendation> = new Map([
const SCRIPT_RECOMMENDATION: Map<string, ApiScriptRecommendation | ClassScriptRecommendation> = new Map([
[
'/setblock',
{
Expand Down Expand Up @@ -295,7 +295,7 @@ const ScriptRecommendations: Map<string, ApiScriptRecommendation | ClassScriptRe
],
]);

const AvoidUnnecessaryCommand = ESLintUtils.RuleCreator(() => 'https://microsoft.com/')<
const AVOID_UNNECESSARY_COMMAND = ESLintUtils.RuleCreator(() => 'https://microsoft.com/')<
[],
'replaceWithScriptMethod' | 'replaceWithScriptFunctionality'
>({
Expand Down Expand Up @@ -324,6 +324,7 @@ const AvoidUnnecessaryCommand = ESLintUtils.RuleCreator(() => 'https://microsoft
defaultOptions: [],
create(context, _options): TSESLint.RuleListener {
return {
// eslint-disable-next-line @typescript-eslint/naming-convention
CallExpression(node) {
// Identify if this is a call to runCommand or runCommandAsync, which occurs either
// off of the exported module object, or through any cached function reference
Expand Down Expand Up @@ -471,7 +472,7 @@ const AvoidUnnecessaryCommand = ESLintUtils.RuleCreator(() => 'https://microsoft

// Now check if there is a script API that provides the same functionality
// by checking our list of recommendations
const recommendation = ScriptRecommendations.get(commandName);
const recommendation = SCRIPT_RECOMMENDATION.get(commandName);
if (recommendation) {
// We have a recommendation, so log the appropriate error
if (isClassRecommendation(recommendation)) {
Expand Down Expand Up @@ -515,4 +516,4 @@ const AvoidUnnecessaryCommand = ESLintUtils.RuleCreator(() => 'https://microsoft
},
});

export default AvoidUnnecessaryCommand;
export default AVOID_UNNECESSARY_COMMAND;
1 change: 1 addition & 0 deletions tools/eslint-plugin-minecraft-linting/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module.exports = {
version,
},
rules: {
// eslint-disable-next-line @typescript-eslint/naming-convention
'avoid-unnecessary-command': AvoidUnnecessaryCommand,
},
};
4 changes: 2 additions & 2 deletions tools/tsconfig/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
"forceConsistentCasingInFileNames": true,
"inlineSources": false,
"isolatedModules": true,
"moduleResolution": "NodeNext",
"moduleResolution": "bundler",
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveWatchOutput": true,
"skipLibCheck": true,
"strict": true,
"sourceMap": true,
"lib": ["ES2020"],
"module": "NodeNext",
"module": "ES2020",
"target": "ES2020"
},
"exclude": ["node_modules"]
Expand Down