eslint-plugin-roblox-ts-x
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

eslint-plugin-roblox-ts-x

npm version npm downloads bundle JSDocs License

A collection of ESLint rules specifically targeted to flag common issues when using roblox-ts. These rules are nearly all designed to help avoid compiler errors for features that are not supported by the roblox-ts compiler, despite being valid TypeScript.

These rules should help users learn roblox-ts when coming from Lua, as well as guiding users who already know TypeScript to avoid unsupported features.

Rules

🔧 Automatically fixable by the --fix CLI option.
💡 Manually fixable by editor suggestions.
💭 Requires type information.

Name Description 🔧 💡 💭
lua-truthiness Enforces the use of lua truthiness 💭
misleading-lua-tuple-checks Disallow the use of LuaTuple in conditional expressions 🔧 💭
no-any Disallow values of type any. Use unknown instead 🔧 💡
no-array-pairs Disallow usage of pairs() and ipairs() with Array 💭
no-enum-merging Disallow merging enum declarations
no-export-assignment-let Disallow using export = on a let variable
no-for-in Disallow iterating with a for-in loop 🔧
no-function-expression-name Disallow the use of function expression names 🔧
no-get-set Disallow getters and setters 🔧
no-invalid-identifier Disallow the use of Luau reserved keywords as identifiers
no-namespace-merging Disallow merging namespace declarations
no-null Disallow usage of the null keyword 🔧
no-object-math Disallow using objects in mathematical operations 🔧 💭
no-post-fix-new Disallow .new() on objects without a .new() method 🔧 💭
no-preceding-spread-element Disallow spread elements not last in a list of arguments 💭
no-private-identifier Disallow the use of private identifiers (#) 🔧
no-unsupported-syntax Disallow unsupported syntax in roblox-ts
no-value-typeof Disallow using typeof to check for value types
prefer-task-library Enforce use of task library alternatives 🔧
size-method Enforce use of .size() instead of .length or .size property 🔧 💭

Installation

You'll first need to install ESLint v9.0.0 or greater:

npm install eslint --save-dev

Next, install eslint-plugin-roblox-ts-x:

npm install eslint-plugin-roblox-ts-x --save-dev

Usage

The easiest way to use eslint-plugin-roblox-ts-x is to use the ready-made config. Config files use all the rules of the current plugin, but you can override them.

Flat Config (eslint.config.ts)

import roblox from 'eslint-plugin-roblox-ts-x'

export default [
	roblox.configs.recommended,
]

Flat Config (eslint.config.ts)

Altertatively, add eslint-plugin-roblox-ts-x to the plugins section of the ESLint configuration file and define the list of rules you will use.

import roblox from 'eslint-plugin-roblox-ts-x'

export default [
	{
		plugins: {
			"roblox-ts-x": roblox,
		},
		rules: {
			"roblox-ts-x/no-any": ["error", { fixToUnknown: true }],
		},
	},
]

License

MIT License © Christopher Buss

Package Sidebar

Install

npm i eslint-plugin-roblox-ts-x

Weekly Downloads

263

Version

1.0.2

License

MIT

Unpacked Size

49 kB

Total Files

5

Last publish

Collaborators

  • isentinel