Skip to content

Commit 6eb2e1f

Browse files
committed
refactor initial commit
0 parents  commit 6eb2e1f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+7987
-0
lines changed

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
trim_trailing_whitespace = true
7+
charset = utf-8
8+
indent_style = tab
9+
indent_size = 4
10+
11+
[*.yml]
12+
indent_style = space
13+
indent_size = 2

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
tests/node_modules
3+
tests/src/errors

.eslintrc

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"parserOptions": {
4+
"jsx": true,
5+
"useJSXTextNode": true,
6+
"ecmaVersion": 2018,
7+
"sourceType": "module",
8+
"project": "./tsconfig.json"
9+
},
10+
"plugins": [
11+
"@typescript-eslint",
12+
"@typescript-eslint/eslint-plugin",
13+
"prettier"
14+
],
15+
"extends": [
16+
"plugin:@typescript-eslint/recommended",
17+
"prettier/@typescript-eslint",
18+
"plugin:prettier/recommended"
19+
],
20+
"rules": {
21+
"prettier/prettier": [
22+
"warn",
23+
{
24+
"semi": true,
25+
"trailingComma": "all",
26+
"singleQuote": false,
27+
"printWidth": 120,
28+
"tabWidth": 4,
29+
"useTabs": true
30+
}
31+
],
32+
"@typescript-eslint/array-type": [
33+
"warn",
34+
{
35+
"default": "generic",
36+
"readonly": "generic"
37+
}
38+
],
39+
"@typescript-eslint/no-floating-promises": ["error", { "ignoreVoid": true }],
40+
"@typescript-eslint/no-unused-vars": "off",
41+
"@typescript-eslint/explicit-function-return-type": "off",
42+
"@typescript-eslint/interface-name-prefix": "off",
43+
"@typescript-eslint/no-empty-function": "off",
44+
"@typescript-eslint/no-namespace": "off",
45+
"@typescript-eslint/no-non-null-assertion": "off",
46+
"@typescript-eslint/no-use-before-define": "off",
47+
"@typescript-eslint/no-require-imports": "error",
48+
"prefer-const": "warn",
49+
"no-undef-init": "error"
50+
}
51+
}

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.ts linguist-language=TypeScript
2+
* text=auto

.github/ISSUE_TEMPLATE/bug_report.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
## Version
11+
12+
<!--- run `rbxtsc -v` -->
13+
**roblox-ts:** 0.3.0
14+
15+
<!--- run `npm list @rbxts/types` -->
16+
**@rbxts/types:** 1.0.275
17+
18+
## Description
19+
<!--- A clear and concise description of what the bug is. -->
20+
21+
## Minimal Reproduction
22+
<!--- Steps/code to reproduce the behavior -->
23+
<!--- If applicable, add screenshots to help explain your problem. -->
24+
25+
**Expected behavior:**
26+
<!--- A clear and concise description of what you expected to happen. -->
27+
28+
**Current behavior:**
29+
<!--- A clear and concise description of what went wrong. -->
30+
31+
32+
## Playground link
33+
[Link here]().
34+
<!--- https://roblox-ts.github.io/playground/ -->
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: Feature request
3+
about: Suggest new functionality be added to roblox-ts
4+
title: ''
5+
labels: feature
6+
assignees: ''
7+
8+
---
9+
10+
<!-- Please make sure your idea meets our design goals, seen here: https://roblox-ts.github.io/docs/index#goals -->
11+
12+
## Suggestion
13+
14+
<!-- A summary of what you'd like to see added or changed -->
15+
16+
## Use Cases
17+
18+
<!--
19+
What do you want to use this for?
20+
What shortcomings exist with current approaches?
21+
-->
22+
23+
## Examples
24+
25+
<!-- Show how this would be used and what the behavior would be -->

.github/ISSUE_TEMPLATE/question.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
name: Question
3+
about: We prefer to be asked in the \#help channel @ https://discord.gg/f6Rn6RY
4+
labels: question
5+
6+
---
7+
8+
<!-- If you have Discord and a Roblox account, please ask us in the #help channel instead of here: https://discord.gg/f6Rn6RY -->

.github/workflows/ci.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
lint:
11+
if: contains(github.event.commits[0].message, '[skip ci]') == false
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v1
17+
with:
18+
submodules: recursive
19+
20+
- uses: bahmutov/npm-install@v1
21+
22+
- name: Run ESLint
23+
run: npm run eslint

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.cmd
2+
coverage.lcov
3+
.nyc_output
4+
coverage
5+
node_modules
6+
out
7+
.DS_Store
8+
.vscode/launch.json
9+
.history

.luacheckrc

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
-- luacheck: ignore
2+
3+
stds.roblox = {
4+
globals = {
5+
-- global functions
6+
"script",
7+
"warn",
8+
"wait",
9+
"spawn",
10+
"delay",
11+
"tick",
12+
"UserSettings",
13+
"settings",
14+
"time",
15+
"typeof",
16+
"game",
17+
"unpack",
18+
"getfenv",
19+
"setfenv",
20+
"workspace",
21+
"plugin",
22+
23+
-- types
24+
"Axes",
25+
"BrickColor",
26+
"CFrame",
27+
"Color3",
28+
"ColorSequence",
29+
"ColorSequenceKeypoint",
30+
"Enum",
31+
"Faces",
32+
"Instance",
33+
"NumberRange",
34+
"NumberSequence",
35+
"NumberSequenceKeypoint",
36+
"PhysicalProperties",
37+
"Ray",
38+
"Random",
39+
"Rect",
40+
"Region3",
41+
"Region3int16",
42+
"TweenInfo",
43+
"UDim",
44+
"UDim2",
45+
"Vector2",
46+
"Vector3",
47+
"Vector3int16",
48+
"DockWidgetPluginGuiInfo",
49+
50+
-- libraries
51+
"utf8",
52+
53+
bit32 = {
54+
fields = {
55+
"arshift",
56+
"band",
57+
"bnot",
58+
"bor",
59+
"btest",
60+
"bxor",
61+
"extract",
62+
"lrotate",
63+
"lshift",
64+
"replace",
65+
"rrotate",
66+
"rshift",
67+
}
68+
},
69+
70+
math = {
71+
fields = {
72+
"clamp",
73+
"sign",
74+
"noise",
75+
}
76+
},
77+
78+
debug = {
79+
fields = {
80+
"profilebegin",
81+
"profileend",
82+
"traceback",
83+
}
84+
},
85+
86+
string = {
87+
fields = {
88+
"split"
89+
}
90+
},
91+
92+
"__LEMUR__",
93+
}
94+
}
95+
96+
stds.testez = {
97+
read_globals = {
98+
"describe",
99+
"it", "itFOCUS", "itSKIP",
100+
"FOCUS", "SKIP", "HACK_NO_XPCALL",
101+
"expect",
102+
}
103+
}
104+
105+
ignore = {
106+
"212", -- Unused argument.
107+
"213", -- Unused loop variable.
108+
"421", -- Shadowing a local variable.
109+
"423", -- Shadowing a loop variable.
110+
"431", -- Shadowing an upvalue.
111+
"432", -- Shadowing an upvalue argument.
112+
}
113+
114+
std = "lua51+roblox"
115+
116+
files["**/*.spec.lua"] = {
117+
std = "+testez",
118+
}
119+
120+
-- prevent max line lengths
121+
max_code_line_length = false
122+
max_string_line_length = false
123+
max_comment_line_length = false

.vscode/settings.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
3+
"editor.formatOnSave": true,
4+
"eslint.format.enable": true,
5+
"files.eol": "\n"
6+
}

CHANGELOG.md

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
### **0.3.1**
2+
- Try/Catch is now banned. See issue #873 for more details.
3+
- Reworked file copying logic! roblox-ts now copies any file/folder it doesn't compile from src -> out.
4+
- This is useful for things like Rojo's *.meta.json files
5+
- JSON modules can now be imported like regular modules. This requires `"resolveJsonModule": true,` in tsconfig.json
6+
- JSON files that get compiled to .lua will _not_ be copied over as .json
7+
- Fixed bug where you could access `arguments` and `globalThis` (TS global variables we don't support)
8+
- --help command now fills full width of terminal
9+
10+
- **BREAKING CHANGE** - node_modules no longer copies under `include`
11+
- You must now add `node_modules/@rbxts` manually into your rojo default.project.json.
12+
- It should sit under your `include` folder.
13+
- So if your `include` part looked like this before:
14+
```JSON
15+
"rbxts_include": {
16+
"$path": "include",
17+
},
18+
```
19+
- It should now look like this:
20+
```JSON
21+
"rbxts_include": {
22+
"$path": "include",
23+
"node_modules": {
24+
"$path": "node_modules/@rbxts"
25+
}
26+
},
27+
```
28+
29+
### **0.3.0**
30+
- Truthiness Rework: Truthiness is now evaluated like in TypeScript/JavaScript. `0`, `""`, and `NaN` are now falsy.
31+
- Added compiler option `--logTruthyChanges`, which displays all code affected by the truthiness change.
32+
- Fixed `&&`/`||` expressions which now respect the control flow of expressions which require multiple statements in Lua.
33+
- Fixed behavior for when libraries require a different version of a package other than the one globally installed in a project.
34+
- Fixed #586 - `new ReadonlySet()` and `new ReadonlyMap()` now work.
35+
- Fixed #604 - `rbxtsc --init package` now fills out package.json better.
36+
- Fix issues relating to method vs callback logic, specifically, making `this` work better as a first parameter. This should improve object composability. See https://git.io/fjxRS
37+
- Converted almost all of our bitwise operators to bit32.
38+
- Fixed our system of checking whether something is a type vs a value.
39+
- Fixed importing system for when your project requires a package version other than the globally installed one.
40+
- Added macro variable `PKG_VERSION` which gets replaced with the "version" string in your package.json file on compile.
41+
- Added support for TS 3.6 Generators, and also added support for directly and indirectly indexing Symbol.iterator from iterable functions and methods. See https://git.io/Jem1l
42+
- Replaced our `getfenv(0).script` calls with passing in `script` as the first parameter in `TS.import` and `TS.getModule`. This means packages will have to be republished, but anyone can easily fix a broken package by inserting `script` as the first parameter themselves.
43+
- Fixed `Array.reduce` and `Array.reduceRight` functions
44+
- They now pass in the right index into the reducer function (arrays start at 0, not 1)
45+
- They now pass the array into the reducer function
46+
- They now error when attempting to reduce an empty array without an initialValue passed in
47+
- `undefined` is now a valid initialValue
48+
- Changed our limited emulation of JS behavior where many array methods wouldn't call callbacks on empty values in arrays (we considered any `nil` value `empty`). Now, every callback in every array method gets called on every item within arrays, even `nil` values if applicable. This should be more straightforward and easier to understand (and easier for our type system). This change shouldn't affect most people, since we discourage using arrays with holes anyway.
49+
- If you need to strip an array of `nil` values, use `Array.filter((v): v is NonNullable<typeof v> => v !== undefined);`
50+
- We should release a library for safely making arrays with holes for that niche use case, where `length` is tracked as a real value.
51+
- Declaring the same enum multiple times (merging) is no longer allowed. As a result `Object.keys` and `Object.values` now work with enums!
52+
- Added support for importing .json files! They will compile to .lua files. (Thanks to Vorlias)
53+
54+
### **0.2.14**
55+
- Fixed analytics bug
56+
57+
### **0.2.13**
58+
- Fixed #285 - Watch mode now recompiles files which import the file you changed
59+
- Fixed #296 - ensure tsconfig.json is readable
60+
- Fixed #297 - better project config errors
61+
- Fixed #573 - fixed call expressions + non null assertion. i.e. `map.get(x)![0]`
62+
- Added analytics to help track most common errors.
63+
- You can opt out globally with `rbxtsc --noAnalytics` (only needed once)
64+
- Opt back in with `rbxtsc --noAnalytics=false`
65+
66+
### **0.2.12**
67+
- Replaced .npmignore with "files" field to resolve npm issues
68+
69+
### **0.2.11**
70+
- Removed empty field initializers from compiled constructor. i.e. `self.field = nil;`
71+
- Renamed "bundle" to "model"
72+
- Added `rbxtsc --init plugin`
73+
- Fixed `rbxtsc --init` bug
74+
75+
### **0.2.10**
76+
- Improved Watch mode stability
77+
- Improved error handling
78+
- Ability to recover from ts-morph failed to refresh file
79+
- Improved destructuring stability
80+
- Added `rbxtsc --init`
81+
- with the following options:
82+
- `rbxtsc --init game`
83+
- `rbxtsc --init bundle`
84+
- `rbxtsc --init package`
85+
- It will not run if you have a non-empty src folder

0 commit comments

Comments
 (0)