Skip to content

Linting

We recommend using ESLint to enforce best practices and coding standards in your App-Compose projects.
Please note that this plugin requires ESLint 9+ and TypeScript.

Use your preferred package manager.

Terminal window
npm install --save-dev --save-exact @grlt-hub/eslint-plugin-app-compose

Import the plugin and add it to your config. Use the recommended preset for a quick start.

import appCompose from "@grlt-hub/eslint-plugin-app-compose"
export default tseslint.config(appCompose.configs.recommended)

You can also configure it manually.

{
plugins: {
'app-compose': appCompose,
},
rules: {
'app-compose/task-options-order': 'warn',
},
}

createTask accepts configuration in an object form. To maintain consistency and readability, configuration properties must follow the semantic order: namerun.contextrun.fnenabled.contextenabled.fn. This rule strictly enforces this sequence.

// 👍 great
createTask({
name: "alpha",
run: { context: { timeout: timeoutTag }, fn: init },
enabled: { context: { authorized: authorizedTag }, fn: check },
})
// 👎 weird
createTask({
name: "alpha",
enabled: { fn: check, context: { authorized: authorizedTag } },
run: { context: { timeout: timeoutTag }, fn: init },
})