Skip to content

Commit 0de22ab

Browse files
committed
style(require): normalize imports and sorting
1 parent 05f176f commit 0de22ab

31 files changed

Lines changed: 108 additions & 79 deletions

.busted

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
local assert = require("luassert")
2-
local ins = require("inspect")
3-
local say = require("say")
4-
local callable = require("luassert.util").callable
1+
local assert = require "luassert"
2+
local ins = require "inspect"
3+
local say = require "say"
4+
local util = require "luassert.util"
55

66
local remove_all_metatables = function(item, path)
77
if path[#path] ~= ins.METATABLE then
@@ -25,7 +25,7 @@ say:set(positive_msg, "Expected object to be callable.\nPassed in:\n%s\nExpected
2525
say:set(negative_msg, "Expected object to not be callable.\nPassed in:\n%s\nDid not expect:\ncallable object")
2626

2727
assert:register("assertion", "callable", function(_, args)
28-
return callable(args[1])
28+
return util.callable(args[1])
2929
end, positive_msg, negative_msg)
3030

3131
return {}

docs/src/getting-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Copy all files from src/mods/ to C:\Program Files\Lua\5.x\lua\mods\
4242
## Basic Usage
4343

4444
```lua [example.lua]
45-
local mods = require("mods")
45+
local mods = require "mods"
4646

4747
local l = mods.List({ "a", "b", "a" })
4848
local s = mods.Set({ "a", "b" })
@@ -53,5 +53,5 @@ local keys = mods.tbl.keys({ a = 1, b = 2 })
5353

5454
> [!NOTE]
5555
>
56-
> Direct module imports such as `require("mods.str")` remain supported for
56+
> Direct module imports such as `require "mods.str"` remain supported for
5757
> compatibility.

spec/List_spec.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
---@diagnostic disable: undefined-global
22

3-
local mods = require("mods")
3+
local mods = require "mods"
4+
45
local List = mods.List
56
local Set = mods.Set
67
local deepcopy = mods.tbl.deepcopy
8+
79
local fmt = string.format
810
local upper = string.upper
911
local len = string.len

spec/Set_spec.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
---@diagnostic disable: undefined-global, need-check-nil
22

3-
local mods = require("mods")
4-
local Set = mods.Set
3+
local mods = require "mods"
4+
55
local List = mods.List
6-
local runtime = mods.runtime
6+
local Set = mods.Set
77
local deepcopy = mods.tbl.deepcopy
8+
local runtime = mods.runtime
9+
810
local upper = string.upper
911
local fmt = string.format
1012
local load = loadstring or load

spec/is_spec.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
local mods = require("mods")
2-
local is = mods.is
3-
local Set = mods.Set
1+
local is = require "mods.is"
2+
local lfs = require "lfs"
3+
44
local fmt = string.format
5-
local lfs = require("lfs")
65

76
describe("mods.is", function()
87
local f = function() end

spec/keyword_spec.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
local mods = require("mods")
1+
local mods = require "mods"
2+
23
local List = mods.List
34
local Set = mods.Set
45
local kw = mods.keyword
6+
57
local fmt = string.format
68
local is_lua51 = _VERSION == "Lua 5.1"
79

spec/ntpath_spec.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
Copyright (c) 2001 Python Software Foundation; All Rights Reserved.
77
]]
88

9-
local lfs = require("lfs")
10-
local mods = require("mods")
9+
local lfs = require "lfs"
10+
local mods = require "mods"
11+
1112
local ntpath = mods.ntpath
12-
local fmt = string.format
1313
local tbl_keys = mods.tbl.keys
1414

15+
local fmt = string.format
16+
1517
local function with_env(env, fn)
1618
stub(os, "getenv", function(name)
1719
return env[name]

spec/operator_spec.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
local operator = require("mods").operator
1+
local operator = require "mods.operator"
2+
23
local fmt = string.format
34

45
describe("mods.operator", function()

spec/path_spec.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
local mods = require("mods")
2-
local path = mods.path
1+
local path = require "mods.path"
2+
33
local fmt = string.format
44

55
describe("mods.path", function()

spec/posixpath_spec.lua

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
Copyright (c) 2001 Python Software Foundation; All Rights Reserved.
77
]]
88

9-
local lfs = require("lfs")
10-
local mods = require("mods")
9+
local lfs = require "lfs"
10+
local mods = require "mods"
11+
1112
local posixpath = mods.posixpath
12-
local fmt = string.format
1313
local tbl_keys = mods.tbl.keys
1414

15+
local fmt = string.format
16+
1517
describe("mods.posixpath", function()
1618
local cwd = lfs.currentdir()
1719
-- stylua: ignore

0 commit comments

Comments
 (0)