Package Exports
- @dazn/eslint-plugin-kopytko
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@dazn/eslint-plugin-kopytko) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Kopytko ESLint plugin
An ESLint plugin with a set of rules
Installation
- Install
eslintpeer dependency:
npm i eslint --save-dev- Install
eslint-plugin-kopytko:
npm i @dazn/eslint-plugin-kopytko --save-devConfiguration
In .eslintrc:
{
"extends": "plugin:@dazn/kopytko/recommended",
"plugins": ["@dazn/kopytko"],
"rules": {
"@dazn/kopytko/dependencies-order": "error",
"@dazn/kopytko/missing-trailing-comma": "error",
"@dazn/kopytko/indent": ["error", 2],
}
}Rules
indent
Enforces consistent indentation of block, array and object expressions, and function declarations
Examples of incorrect code for this rule, set to 2 characters:
sub test()
example = [
1,
2,
]
if (1 = 1)
superFunction({
a: "a",
b: "b",
c: "c",
})
end if
end sub
sub another()
superFunction({})
end subExamples of correct code for this rule, set to 2 characters:
sub test()
example = [
1,
2,
]
if (1 = 1)
superFunction({
a: "a",
b: "b",
c: "c",
})
end if
end sub
sub another()
superFunction({})
end submissing-trailing-comma
Enforces a trailing comma after every property of multiline associative array
The --fix option on the command line can automatically fix some of the problems reported by this rule.
Examples of incorrect code for this rule:
test = {
a: "a",
b: "b"
}Examples of correct code for this rule:
test = {
a: "a",
b: "b",
}dependencies-order
A rule to use with Kopytko Packager 's importing mechanism and Kopytko Unit Testing Framework 's mocking mechanism.
Enforces a proper alphabetical and path-specific order of @import and @mock annotations:
@mockannotations have to be after all@importannotations- alphabetical order of paths
- nested paths have to be declared after their root path
Examples of incorrect code for this rule:
' @mock /components/mocked-function.brs
' @import /components/nested/cool-function.brs
' @import /components/nested/another-function.brs
' @import /components/main-function.brsExamples of correct code for this rule:
' @import /components/main-function.brs
' @import /components/nested/another-function.brs
' @import /components/nested/cool-function.brs
' @mock /components/mocked-function.brsRecommendation
We recommend to use also eslint-plugin-roku rules