trmnl_preview 0.30.3 → 0.30.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/trmnlp/lint/checks/no_negative_spacing.rb +34 -0
- data/lib/trmnlp/lint/diagnostic.rb +2 -1
- data/lib/trmnlp/lint.rb +2 -0
- data/lib/trmnlp/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 19d57b76b4b9fac2e897d2b4f18459bce312329e9ed647cb950781e5834387e6
|
|
4
|
+
data.tar.gz: 3f12fe83acc40963e8a36a218275e42713aa5211ea80761cb46a44d72889de01
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ec019e1a423c47855cd9a96b1ef39578135e99aa9fb8b2b807e67f919b08884d360a180bc4619dcbdace7bf99095eeea4d1a69d672f6821a66ea3d33a78ee9c7
|
|
7
|
+
data.tar.gz: 4bb9acf58ffd364b56a265a16e4a4d2cafa48847cc763c27f7d74d0fd0b261cc69fca465e6af327cfbdd7fb8e116cff46f9fff372e636b9733679af875834758
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
# Changelog
|
|
3
3
|
|
|
4
|
+
## 0.30.4
|
|
5
|
+
|
|
6
|
+
- `trmnlp lint` reports a margin, padding, gap or position class with a leading minus (`no_negative_spacing`), such as `-mt--2` or `lg:-top--1`. Tailwind writes negative values this way, but no Framework release defines a class that starts with a minus, so TRMNL ignores it and says nothing: an icon nudged up with `-mt--1` stays where it was.
|
|
7
|
+
|
|
4
8
|
## 0.30.3
|
|
5
9
|
|
|
6
10
|
- `trmnlp test` serves the Framework's stylesheets, scripts and fonts from a cache in `~/.cache/trmnl/assets`, downloaded from trmnl.com once and kept as long as trmnl.com says. A run no longer fails when trmnl.com is slow or down, as long as the files were fetched before; when a file is due for a refresh and trmnl.com cannot be reached, the copy on disk is used.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../check'
|
|
4
|
+
|
|
5
|
+
module TRMNLP
|
|
6
|
+
module Lint
|
|
7
|
+
module Checks
|
|
8
|
+
# Reports margin, padding, gap and position classes written with a leading
|
|
9
|
+
# minus, such as `-mt--2` or `lg:-top--1`. Tailwind spells negative values
|
|
10
|
+
# this way, but no Framework release, from 1.0.0 to 3.4.2, defines a class
|
|
11
|
+
# that starts with a minus, so the class does nothing and nothing says so:
|
|
12
|
+
# an icon nudged up with `-mt--1` stays where it was.
|
|
13
|
+
class NoNegativeSpacing < Check
|
|
14
|
+
LEARN_MORE = 'https://trmnl.com/framework/docs/spacing'
|
|
15
|
+
|
|
16
|
+
PATTERN = /
|
|
17
|
+
(?<![\w:-])
|
|
18
|
+
(?<prefix>(?:[a-z0-9]+:)*)
|
|
19
|
+
-(?<family>[mp][trblxy]?|gap|top|right|bottom|left|inset)
|
|
20
|
+
--(?<value>[\w.]+)
|
|
21
|
+
(?![\w-])
|
|
22
|
+
/x
|
|
23
|
+
|
|
24
|
+
def issues
|
|
25
|
+
source.all_markup.scan(PATTERN).uniq.map do |prefix, family, value|
|
|
26
|
+
{ message: "'#{prefix}-#{family}--#{value}' has no effect: " \
|
|
27
|
+
"the Framework has no negative '#{family}--' classes.",
|
|
28
|
+
learn_more: LEARN_MORE }
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -43,7 +43,8 @@ module TRMNLP
|
|
|
43
43
|
return source.locations(MARKUP_PATTERNS[rule_id]) if MARKUP_PATTERNS.key?(rule_id)
|
|
44
44
|
|
|
45
45
|
case rule_id
|
|
46
|
-
when 'arbitrary_values_in_range', 'framework_classes_exist', 'framework_prefixes_exist'
|
|
46
|
+
when 'arbitrary_values_in_range', 'no_negative_spacing', 'framework_classes_exist', 'framework_prefixes_exist'
|
|
47
|
+
class_locations
|
|
47
48
|
when 'layouts_have_content' then empty_view_locations
|
|
48
49
|
when 'form_fields_valid' then form_field_locations
|
|
49
50
|
when 'custom_field_links_embedded' then custom_field_description_locations
|
data/lib/trmnlp/lint.rb
CHANGED
|
@@ -13,6 +13,7 @@ require_relative 'lint/checks/limited_inline_styles'
|
|
|
13
13
|
require_relative 'lint/checks/no_style_restyling_framework'
|
|
14
14
|
require_relative 'lint/checks/no_size_classes'
|
|
15
15
|
require_relative 'lint/checks/arbitrary_values_in_range'
|
|
16
|
+
require_relative 'lint/checks/no_negative_spacing'
|
|
16
17
|
require_relative 'lint/checks/no_opacity'
|
|
17
18
|
require_relative 'lint/checks/gray_text_has_one_bit_class'
|
|
18
19
|
require_relative 'lint/checks/highcharts_animations_disabled'
|
|
@@ -52,6 +53,7 @@ module TRMNLP
|
|
|
52
53
|
Checks::NoStyleRestylingFramework,
|
|
53
54
|
Checks::NoSizeClasses,
|
|
54
55
|
Checks::ArbitraryValuesInRange,
|
|
56
|
+
Checks::NoNegativeSpacing,
|
|
55
57
|
Checks::NoOpacity,
|
|
56
58
|
Checks::GrayTextHasOneBitClass,
|
|
57
59
|
Checks::HighchartsAnimationsDisabled,
|
data/lib/trmnlp/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: trmnl_preview
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.30.
|
|
4
|
+
version: 0.30.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rockwell Schrock
|
|
@@ -441,6 +441,7 @@ files:
|
|
|
441
441
|
- lib/trmnlp/lint/checks/no_async_functions.rb
|
|
442
442
|
- lib/trmnlp/lint/checks/no_custom_filters.rb
|
|
443
443
|
- lib/trmnlp/lint/checks/no_external_qr_codes.rb
|
|
444
|
+
- lib/trmnlp/lint/checks/no_negative_spacing.rb
|
|
444
445
|
- lib/trmnlp/lint/checks/no_nested_layouts.rb
|
|
445
446
|
- lib/trmnlp/lint/checks/no_opacity.rb
|
|
446
447
|
- lib/trmnlp/lint/checks/no_refresh_rate_field.rb
|