File tree Expand file tree Collapse file tree 4 files changed +80
-11
lines changed Expand file tree Collapse file tree 4 files changed +80
-11
lines changed Original file line number Diff line number Diff line change
1
+ // Import necessary modules for flat config
2
+ import tsParser from "@typescript-eslint/parser" ;
3
+ // Import the local plugin using ES Module syntax
4
+ import localPlugin from "./index.js" ; // Assumes index.js is the entry point
5
+
6
+ const allPluginRules = { } ;
7
+ const pluginName = "assemblyscript" ; // Use the plugin name defined in bash
8
+
9
+ // Access rules from the default export of the plugin module
10
+ if ( localPlugin && localPlugin . rules ) {
11
+ for ( const ruleName in localPlugin . rules ) {
12
+ // Construct the full rule name: 'plugin-name/rule-name'
13
+ allPluginRules [ `${ pluginName } /${ ruleName } ` ] = "warn" ; // Set default severity
14
+ }
15
+ } else {
16
+ console . warn (
17
+ `Plugin '${ pluginName } ' loaded from ./index.js does not seem to export rules correctly.`
18
+ ) ;
19
+ }
20
+
21
+ // Export the flat config array
22
+ export default [
23
+ {
24
+ // Apply to TypeScript files in the target directory
25
+ files : [ "**/*.ts" ] ,
26
+ languageOptions : {
27
+ parser : tsParser ,
28
+ parserOptions : {
29
+ ecmaVersion : "latest" ,
30
+ sourceType : "module" ,
31
+ } ,
32
+ } ,
33
+ // Define the plugin using the imported object
34
+ plugins : {
35
+ [ pluginName ] : localPlugin ,
36
+ } ,
37
+ // Apply the dynamically generated rules
38
+ rules : allPluginRules ,
39
+ } ,
40
+ ] ;
Original file line number Diff line number Diff line change 4
4
5
5
set -e # Exit immediately if a command exits with a non-zero status.
6
6
7
- TARGET_DIR=" $1 "
7
+ TARGET_DIR=" sample_cases/usecase-wasm-vehicle-status-25/source "
8
8
# Use .mjs for ES Module flat config
9
- CONFIG_FILE=" .eslintrc.tmp .mjs"
9
+ CONFIG_FILE=" eslint.config .mjs"
10
10
PLUGIN_NAME=" assemblyscript" # Plugin name prefix used in rules
11
11
12
12
# Check if target directory is provided
@@ -22,18 +22,12 @@ if [ ! -d "$TARGET_DIR" ]; then
22
22
fi
23
23
24
24
# Create a temporary ESLint flat config file (.mjs)
25
- cat > " $CONFIG_FILE " << EOL
25
+ cat > " $CONFIG_FILE " << EOL
26
26
// Import necessary modules for flat config
27
- import path from 'path';
28
- import { fileURLToPath } from 'url';
29
27
import tsParser from '@typescript-eslint/parser';
30
28
// Import the local plugin using ES Module syntax
31
29
import localPlugin from './index.js'; // Assumes index.js is the entry point
32
30
33
- // Helper to get current directory in ES Modules
34
- const __filename = fileURLToPath(import.meta.url);
35
- const __dirname = path.dirname(__filename);
36
-
37
31
const allPluginRules = {};
38
32
const pluginName = '${PLUGIN_NAME} '; // Use the plugin name defined in bash
39
33
83
77
fi
84
78
85
79
# Clean up the temporary config file
86
- rm " $CONFIG_FILE "
80
+ # rm "$CONFIG_FILE"
87
81
echo " Removed temporary config file: $CONFIG_FILE "
88
82
89
83
exit $EXIT_CODE
Original file line number Diff line number Diff line change 27
27
],
28
28
"scripts" : {
29
29
"build" : " npx tsc --build ./tsconfig.json" ,
30
- "test" : " ./test-lint.sh"
30
+ "test" : " ./test-lint.sh" ,
31
+ "lint" : " npx eslint test_case/hello.ts"
31
32
},
32
33
"peerDependencies" : {
33
34
"eslint" : " >=8.0.0"
Original file line number Diff line number Diff line change
1
+ import { DelayType } from "@utils/time-utils" ;
2
+
3
+ export namespace TimingConfig {
4
+ export const defaultCooldownStandard : u32 = DelayType . STANDARD ;
5
+ /**
6
+ * Cooldown duration for urban positioning scenarios
7
+ */
8
+ export const urbanPositioningCooldown = DelayType . SHORT ;
9
+ /**
10
+ * Cooldown duration for high-speed positioning scenarios
11
+ */
12
+ export const highSpeedPositioningCooldown = DelayType . LONG ;
13
+ }
14
+
15
+ /**
16
+ * Distance-based emission strategy
17
+ */
18
+ export class DistanceBasedDeliveryStrategy implements EmissionStrategy {
19
+ private context : SystemContext ;
20
+ constructor ( context : SystemContext ) {
21
+ this . context = context ;
22
+ }
23
+ isEmissionConditionMet ( emissionGroup : EmissionGroup ) : boolean {
24
+ void emissionGroup ;
25
+ return true ;
26
+ }
27
+ determineCooldown ( emissionGroup : EmissionGroup ) : DelayType {
28
+ void emissionGroup ;
29
+ return this . context . getCurrentZone ( ) . isPresent ( ) &&
30
+ this . context . getCurrentZone ( ) . get ( ) === ZoneType . RESIDENTIAL
31
+ ? DelayType . SHORT
32
+ : DelayType . NEVER ;
33
+ }
34
+ }
You can’t perform that action at this time.
0 commit comments