npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dazn/eslint-plugin-kopytko

v2.1.0

Published

Set of brightscript rules for eslint

Downloads

6

Readme

Kopytko ESLint plugin

An ESLint plugin with a set of rules

Installation

  1. Install eslint peer dependency:
npm i eslint --save-dev
  1. Install eslint-plugin-kopytko:
npm i @dazn/eslint-plugin-kopytko --save-dev

Configuration

In .eslintrc:

{
  "extends": "plugin:@dazn/kopytko/recommended",
  "plugins": ["@dazn/kopytko"]
}

Rules

@dazn/kopytko/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:

  1. imports or mocks from external packages have to be before local ones
  2. @mock annotations have to be after all @import annotations
  3. alphabetical order of external packages names
  4. alphabetical order of paths
  5. nested paths have to be declared after their root path

External packages before local

Example of incorrect code:

' @import /components/main-function.brs
' @import /components/nested/another-function.brs
' @import /components/nested/cool-function.brs
' @import /components/nested/some-function.brs from package-name
' @mock /components/mocked-function.brs
' @mock /components/some-mocked-function.brs from package-name

Example of correct code:

' @import /components/nested/some-function.brs from package-name
' @mock /components/some-mocked-function.brs from package-name
' @import /components/main-function.brs
' @import /components/nested/another-function.brs
' @import /components/nested/cool-function.brs
' @mock /components/mocked-function.brs

Imports before mocks

Example of incorrect code:

' @mock /components/mocked-function.brs
' @import /components/main-function.brs
' @import /components/nested/another-function.brs
' @import /components/nested/cool-function.brs

Example of correct code:

' @import /components/main-function.brs
' @import /components/nested/another-function.brs
' @import /components/nested/cool-function.brs
' @mock /components/mocked-function.brs

Alphabetical order of external packages names

Example of incorrect code:

' @import /components/a-function.brs from package-name
' @import /components/some-function.brs from another-package-name
' @mock /components/another-mocked-function.brs from package-name
' @mock /components/some-mocked-function.brs from another-package-name
' @import /components/main-function.brs
' @mock /components/mocked-function.brs

Example of correct code:

' @import /components/some-function.brs from another-package-name
' @import /components/a-function.brs from package-name
' @mock /components/some-mocked-function.brs from another-package-name
' @mock /components/another-mocked-function.brs from package-name
' @import /components/main-function.brs
' @mock /components/mocked-function.brs

Alphabetical order of paths

Example of incorrect code:

' @import /components/nested/another-function.brs
' @import /components/main-function.brs
' @import /components/nested/cool-function.brs
' @mock /components/some-mocked-function.brs
' @mock /components/mocked-function.brs

Example of correct code:

' @import /components/main-function.brs
' @import /components/nested/another-function.brs
' @import /components/nested/cool-function.brs
' @mock /components/mocked-function.brs
' @mock /components/some-mocked-function.brs

@dazn/kopytko/function-no-return

Check if function with defined return type has return statement.

Examples of incorrect code for this rule:

function calc() as Integer
  result = 1 + 2
end function

Examples of correct code for this rule:

function calc() as Integer
  result = 1 + 2
  return result
end function

@dazn/kopytko/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 sub

Examples 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 sub

@dazn/kopytko/missing-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",
}

@dazn/kopytko/no-uninitialized-variables

Check that all variables are declared.

Examples of incorrect code for this rule:

sub a()
  print(foo)
end sub

Examples of correct code for this rule:

sub a()
  foo = "bar"
  print(foo)
end sub

@dazn/kopytko/sub-to-function

Check that sub doesn't have a return type.

Examples of incorrect code for this rule:

sub a() as Dynamic
end sub

Examples of correct code for this rule:

sub a()
  print("foo")
end sub

@dazn/kopytko/no-print

Disallows the use of print.

@dazn/kopytko/no-stop

Disallows the use of stop.