From d88a371b0e4871735422ae3c28ef5b352304bb58 Mon Sep 17 00:00:00 2001 From: Ju Liu <ju@noredink.com> Date: Tue, 15 Mar 2022 16:59:55 +0000 Subject: [PATCH 1/7] Add elm-review --- review/elm.json | 35 +++++++++++++++++++++++++++++++++ review/src/ReviewConfig.elm | 39 +++++++++++++++++++++++++++++++++++++ shell.nix | 6 +++++- 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 review/elm.json create mode 100644 review/src/ReviewConfig.elm diff --git a/review/elm.json b/review/elm.json new file mode 100644 index 00000000..b85f1ad9 --- /dev/null +++ b/review/elm.json @@ -0,0 +1,35 @@ +{ + "type": "application", + "source-directories": [ + "src" + ], + "elm-version": "0.19.1", + "dependencies": { + "direct": { + "elm/core": "1.0.5", + "elm/json": "1.1.3", + "elm/project-metadata-utils": "1.0.2", + "jfmengels/elm-review": "2.7.0", + "jfmengels/elm-review-unused": "1.1.20", + "stil4m/elm-syntax": "7.2.9" + }, + "indirect": { + "elm/html": "1.0.0", + "elm/parser": "1.1.0", + "elm/random": "1.0.0", + "elm/time": "1.0.0", + "elm/virtual-dom": "1.0.2", + "elm-community/list-extra": "8.5.2", + "elm-explorations/test": "1.2.2", + "miniBill/elm-unicode": "1.0.2", + "rtfeldman/elm-hex": "1.0.0", + "stil4m/structured-writer": "1.0.3" + } + }, + "test-dependencies": { + "direct": { + "elm-explorations/test": "1.2.2" + }, + "indirect": {} + } +} diff --git a/review/src/ReviewConfig.elm b/review/src/ReviewConfig.elm new file mode 100644 index 00000000..58e8cc0f --- /dev/null +++ b/review/src/ReviewConfig.elm @@ -0,0 +1,39 @@ +module ReviewConfig exposing (config) + +{-| Do not rename the ReviewConfig module or the config function, because +`elm-review` will look for these. + +To add packages that contain rules, add them to this review project using + + `elm install author/packagename` + +when inside the directory containing this file. + +-} + +import NoUnused.CustomTypeConstructorArgs +import NoUnused.CustomTypeConstructors +import NoUnused.Dependencies +import NoUnused.Exports +import NoUnused.Modules +import NoUnused.Parameters +import NoUnused.Patterns +import NoUnused.Variables +import Review.Rule exposing (Rule) + + +config : List Rule +config = + [ NoUnused.CustomTypeConstructors.rule [] + , NoUnused.CustomTypeConstructorArgs.rule + , NoUnused.Dependencies.rule + + -- We want to include all functions even if they're unused in this repository. + -- , NoUnused.Exports.rule + , NoUnused.Modules.rule + + -- We like to keep parameters around for readability. + -- , NoUnused.Parameters.rule + -- , NoUnused.Patterns.rule + , NoUnused.Variables.rule + ] diff --git a/shell.nix b/shell.nix index 0348e5d9..1505abcd 100644 --- a/shell.nix +++ b/shell.nix @@ -1,6 +1,9 @@ let sources = import ./nix/sources.nix; - system = if builtins.currentSystem == "aarch64-darwin" then "x86_64-darwin" else builtins.currentSystem; + system = if builtins.currentSystem == "aarch64-darwin" then + "x86_64-darwin" + else + builtins.currentSystem; nixpkgs = import sources.nixpkgs { inherit system; }; niv = nixpkgs.callPackage sources.niv { }; in with nixpkgs; @@ -25,6 +28,7 @@ stdenv.mkDerivation { elmPackages.elm-format elmPackages.elm-test elmPackages.elm-verify-examples + elmPackages.elm-review (pkgs.callPackage sources.elm-forbid-import { }) # preview dependencies From f2f4796648f31c0ebeb8b70aaf43a3ac9f9879e8 Mon Sep 17 00:00:00 2001 From: Ju Liu <ju@noredink.com> Date: Tue, 15 Mar 2022 17:13:25 +0000 Subject: [PATCH 2/7] Run autofix --- src/ClickableAttributes.elm | 2 +- src/InputErrorAndGuidanceInternal.elm | 2 +- src/InputLabelInternal.elm | 1 - src/Nri/Ui/Accordion/V1.elm | 1 - src/Nri/Ui/Accordion/V3.elm | 4 +--- src/Nri/Ui/Button/V10.elm | 1 - src/Nri/Ui/Checkbox/V5.elm | 3 --- src/Nri/Ui/ClickableSvg/V2.elm | 9 --------- src/Nri/Ui/Colors/V1.elm | 2 +- src/Nri/Ui/Container/V2.elm | 1 - src/Nri/Ui/DisclosureIndicator/V2.elm | 2 +- src/Nri/Ui/FocusTrap/V1.elm | 9 ++------- src/Nri/Ui/Heading/V2.elm | 2 +- src/Nri/Ui/Html/V3.elm | 4 +--- src/Nri/Ui/Loading/V1.elm | 4 ++-- src/Nri/Ui/Menu/V2.elm | 16 +--------------- src/Nri/Ui/Message/V3.elm | 2 -- src/Nri/Ui/Modal/V11.elm | 9 +-------- src/Nri/Ui/Palette/V1.elm | 2 +- src/Nri/Ui/PremiumCheckbox/V6.elm | 2 +- src/Nri/Ui/PremiumCheckbox/V7.elm | 2 +- src/Nri/Ui/RadioButton/V2.elm | 20 ++------------------ src/Nri/Ui/RadioButton/V3.elm | 19 +++---------------- src/Nri/Ui/RadioButton/V4.elm | 2 +- src/Nri/Ui/SegmentedControl/V14.elm | 7 +------ src/Nri/Ui/Select/V8.elm | 3 +-- src/Nri/Ui/SideNav/V1.elm | 5 +---- src/Nri/Ui/SlideModal/V2.elm | 2 -- src/Nri/Ui/SortableTable/V2.elm | 3 +-- src/Nri/Ui/Tabs/V6.elm | 2 +- src/Nri/Ui/Tabs/V7.elm | 1 - src/Nri/Ui/Text/V6.elm | 2 +- src/Nri/Ui/TextArea/V4.elm | 4 +--- src/Nri/Ui/TextInput/V7.elm | 8 +------- src/Nri/Ui/Tooltip/V1.elm | 2 +- tests/Spec/Nri/Ui/Page.elm | 2 +- tests/Spec/Nri/Ui/PremiumCheckbox.elm | 2 +- tests/Spec/Nri/Ui/SortableTable.elm | 3 +-- tests/Spec/Nri/Ui/Tooltip.elm | 2 -- 39 files changed, 34 insertions(+), 135 deletions(-) diff --git a/src/ClickableAttributes.elm b/src/ClickableAttributes.elm index 988f3342..5d0ad153 100644 --- a/src/ClickableAttributes.elm +++ b/src/ClickableAttributes.elm @@ -19,7 +19,7 @@ import Html.Styled exposing (Attribute) import Html.Styled.Attributes as Attributes import Html.Styled.Events as Events import Json.Decode -import Nri.Ui.Html.Attributes.V2 as AttributeExtras exposing (targetBlank) +import Nri.Ui.Html.Attributes.V2 exposing (targetBlank) {-| -} diff --git a/src/InputErrorAndGuidanceInternal.elm b/src/InputErrorAndGuidanceInternal.elm index 9f880e82..6dc1f8d4 100644 --- a/src/InputErrorAndGuidanceInternal.elm +++ b/src/InputErrorAndGuidanceInternal.elm @@ -15,7 +15,7 @@ module InputErrorAndGuidanceInternal exposing -} import Accessibility.Styled.Aria as Aria -import Css exposing (Style) +import Css import Html.Styled as Html exposing (Html) import Nri.Ui.Html.Attributes.V2 import Nri.Ui.Message.V3 as Message diff --git a/src/InputLabelInternal.elm b/src/InputLabelInternal.elm index 5c45f89a..3efcd3b6 100644 --- a/src/InputLabelInternal.elm +++ b/src/InputLabelInternal.elm @@ -11,7 +11,6 @@ import Accessibility.Styled.Style as Accessibility import Css import Html.Styled.Attributes as Attributes import InputErrorAndGuidanceInternal exposing (ErrorState) -import Nri.Ui.Colors.V1 as Colors import Nri.Ui.InputStyles.V3 as InputStyles exposing (Theme) diff --git a/src/Nri/Ui/Accordion/V1.elm b/src/Nri/Ui/Accordion/V1.elm index 5fe18bf7..9cff4acb 100644 --- a/src/Nri/Ui/Accordion/V1.elm +++ b/src/Nri/Ui/Accordion/V1.elm @@ -13,7 +13,6 @@ module Nri.Ui.Accordion.V1 exposing -} import Accessibility.Styled exposing (Attribute, Html, button, div, text) -import Accessibility.Styled.Role as Role import Css exposing (..) import Css.Global import Html.Styled.Attributes as Attributes diff --git a/src/Nri/Ui/Accordion/V3.elm b/src/Nri/Ui/Accordion/V3.elm index 9215ccf7..8fd5a113 100644 --- a/src/Nri/Ui/Accordion/V3.elm +++ b/src/Nri/Ui/Accordion/V3.elm @@ -59,10 +59,9 @@ module Nri.Ui.Accordion.V3 exposing -} -import Accessibility.Styled exposing (Attribute, Html, button, div, section, text) +import Accessibility.Styled exposing (Html, button, div, section) import Accessibility.Styled.Aria as Aria import Accessibility.Styled.Key as Key -import Accessibility.Styled.Role as Role import Accessibility.Styled.Widget as Widget import Css exposing (..) import Css.Global @@ -70,7 +69,6 @@ import Html.Styled.Attributes as Attributes import Html.Styled.Events as Events exposing (onClick) import Html.Styled.Keyed import Json.Decode as Decode -import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Fonts.V1 as Fonts import Nri.Ui.Html.Attributes.V2 as AttributesExtra diff --git a/src/Nri/Ui/Button/V10.elm b/src/Nri/Ui/Button/V10.elm index b16aed24..980c77d7 100644 --- a/src/Nri/Ui/Button/V10.elm +++ b/src/Nri/Ui/Button/V10.elm @@ -84,7 +84,6 @@ adding a span around the text could potentially lead to regressions. import Accessibility.Styled as Html exposing (Html) import Accessibility.Styled.Role as Role -import Accessibility.Styled.Style exposing (invisibleStyle) import Accessibility.Styled.Widget as Widget import ClickableAttributes exposing (ClickableAttributes) import Css exposing (Style) diff --git a/src/Nri/Ui/Checkbox/V5.elm b/src/Nri/Ui/Checkbox/V5.elm index 7ca32d34..9d30795c 100644 --- a/src/Nri/Ui/Checkbox/V5.elm +++ b/src/Nri/Ui/Checkbox/V5.elm @@ -28,19 +28,16 @@ module Nri.Ui.Checkbox.V5 exposing -} import Accessibility.Styled as Html -import Accessibility.Styled.Aria as Aria import Accessibility.Styled.Style import Accessibility.Styled.Widget as Widget import Css exposing (..) import Css.Global -import Html.Events import Html.Styled import Html.Styled.Attributes as Attributes exposing (css) import Html.Styled.Events as Events import Json.Decode import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Fonts.V1 as Fonts -import Nri.Ui.Html.V3 as HtmlExtra exposing (defaultOptions) import Nri.Ui.Svg.V1 exposing (Svg) import Svg.Styled as Svg import Svg.Styled.Attributes as SvgAttributes diff --git a/src/Nri/Ui/ClickableSvg/V2.elm b/src/Nri/Ui/ClickableSvg/V2.elm index 43107388..5dabb165 100644 --- a/src/Nri/Ui/ClickableSvg/V2.elm +++ b/src/Nri/Ui/ClickableSvg/V2.elm @@ -491,15 +491,6 @@ renderButton ((ButtonOrLink config) as button_) = ] -type Link - = Default - | WithTracking - | SinglePageApp - | WithMethod String - | External - | ExternalWithTracking - - renderLink : ButtonOrLink msg -> Html msg renderLink ((ButtonOrLink config) as link_) = let diff --git a/src/Nri/Ui/Colors/V1.elm b/src/Nri/Ui/Colors/V1.elm index 2b604503..5c8c0339 100644 --- a/src/Nri/Ui/Colors/V1.elm +++ b/src/Nri/Ui/Colors/V1.elm @@ -57,7 +57,7 @@ consider [elm-color-extra](http://package.elm-lang.org/packages/eskimoblood/elm- -} -import Css exposing (hex, rgba) +import Css exposing (hex) import Nri.Ui.Colors.Extra exposing (withAlpha) diff --git a/src/Nri/Ui/Container/V2.elm b/src/Nri/Ui/Container/V2.elm index 310dbf84..645937f3 100644 --- a/src/Nri/Ui/Container/V2.elm +++ b/src/Nri/Ui/Container/V2.elm @@ -54,7 +54,6 @@ import Nri.Ui import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Html.Attributes.V2 as ExtraAttributes import Nri.Ui.MediaQuery.V1 exposing (mobile) -import Nri.Ui.Text.V6 as Text {-| -} diff --git a/src/Nri/Ui/DisclosureIndicator/V2.elm b/src/Nri/Ui/DisclosureIndicator/V2.elm index 116eed80..11cc7dd7 100644 --- a/src/Nri/Ui/DisclosureIndicator/V2.elm +++ b/src/Nri/Ui/DisclosureIndicator/V2.elm @@ -20,7 +20,7 @@ A caret that indicates that a section can expand and collapse. When `isOpen` is -} import Css exposing (..) -import Html.Styled as Html exposing (..) +import Html.Styled exposing (..) import Html.Styled.Attributes exposing (css) import Nri.Ui.Colors.V1 as Colors import Nri.Ui.SpriteSheet exposing (arrowLeft) diff --git a/src/Nri/Ui/FocusTrap/V1.elm b/src/Nri/Ui/FocusTrap/V1.elm index 9251bcbe..cf350f4a 100644 --- a/src/Nri/Ui/FocusTrap/V1.elm +++ b/src/Nri/Ui/FocusTrap/V1.elm @@ -6,14 +6,9 @@ module Nri.Ui.FocusTrap.V1 exposing (FocusTrap, toAttribute) -} -import Accessibility.Styled as Html exposing (..) -import Accessibility.Styled.Key as Key -import Browser.Dom as Dom -import Browser.Events -import Html.Styled.Attributes as Attributes exposing (class, id) -import Html.Styled.Events as Events exposing (onClick) +import Accessibility.Styled as Html +import Html.Styled.Events as Events import Json.Decode as Decode exposing (Decoder) -import Task {-| Defines how focus will wrap in reponse to tab keypresses in a part of the UI. diff --git a/src/Nri/Ui/Heading/V2.elm b/src/Nri/Ui/Heading/V2.elm index c4b1756b..c8c6f126 100644 --- a/src/Nri/Ui/Heading/V2.elm +++ b/src/Nri/Ui/Heading/V2.elm @@ -25,7 +25,7 @@ Headings with customization options for accessibility. import Css exposing (..) import Html.Styled exposing (..) -import Html.Styled.Attributes as Attributes exposing (css) +import Html.Styled.Attributes as Attributes import Nri.Ui.Colors.V1 exposing (..) import Nri.Ui.Fonts.V1 as Fonts import Nri.Ui.Html.Attributes.V2 as ExtraAttributes diff --git a/src/Nri/Ui/Html/V3.elm b/src/Nri/Ui/Html/V3.elm index 3d32ce7e..c96a8ba1 100644 --- a/src/Nri/Ui/Html/V3.elm +++ b/src/Nri/Ui/Html/V3.elm @@ -10,9 +10,7 @@ module Nri.Ui.Html.V3 exposing -} -import Char -import Html.Styled as Html exposing (Attribute, Html, span, text) -import Html.Styled.Attributes exposing (..) +import Html.Styled as Html exposing (Attribute, Html) import Html.Styled.Events as Events exposing (..) import Json.Decode diff --git a/src/Nri/Ui/Loading/V1.elm b/src/Nri/Ui/Loading/V1.elm index 7de5ddf6..9211a0c0 100644 --- a/src/Nri/Ui/Loading/V1.elm +++ b/src/Nri/Ui/Loading/V1.elm @@ -10,14 +10,14 @@ module Nri.Ui.Loading.V1 exposing -} -import Css exposing (..) +import Css import Css.Animations import Html.Styled as Html exposing (Html) import Html.Styled.Attributes as Attributes import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Svg.V1 import Nri.Ui.UiIcon.V1 as UiIcon -import Svg.Styled as Svg exposing (Svg) +import Svg.Styled as Svg import Svg.Styled.Attributes as SvgAttributes diff --git a/src/Nri/Ui/Menu/V2.elm b/src/Nri/Ui/Menu/V2.elm index 905a6295..dea33d1e 100644 --- a/src/Nri/Ui/Menu/V2.elm +++ b/src/Nri/Ui/Menu/V2.elm @@ -47,9 +47,8 @@ import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Fonts.V1 import Nri.Ui.Html.Attributes.V2 as AttributesExtra import Nri.Ui.Html.V3 exposing (viewJust) -import Nri.Ui.Svg.V1 as Svg exposing (Svg) +import Nri.Ui.Svg.V1 as Svg import Nri.Ui.UiIcon.V1 as UiIcon -import String.Extra @@ -487,19 +486,6 @@ viewEntry focusAndToggle { upId, downId, entry_ } = -- STYLES -buttonLinkResets : List Style -buttonLinkResets = - [ boxSizing borderBox - , border zero - , padding zero - , margin zero - , backgroundColor transparent - , cursor pointer - , display inlineBlock - , verticalAlign middle - ] - - {-| -} styleInnerContainer : List (Attribute msg) styleInnerContainer = diff --git a/src/Nri/Ui/Message/V3.elm b/src/Nri/Ui/Message/V3.elm index 05ee7abd..290d76e4 100644 --- a/src/Nri/Ui/Message/V3.elm +++ b/src/Nri/Ui/Message/V3.elm @@ -63,12 +63,10 @@ Changes from V2: import Accessibility.Styled as Html exposing (..) import Accessibility.Styled.Role as Role import Accessibility.Styled.Style exposing (invisibleStyle) -import Accessibility.Styled.Widget as Widget import Css exposing (..) import Css.Global import Css.Media exposing (MediaQuery) import Html.Styled.Attributes as Attributes -import Html.Styled.Events exposing (onClick) import Http import Markdown import Nri.Ui diff --git a/src/Nri/Ui/Modal/V11.elm b/src/Nri/Ui/Modal/V11.elm index 8799d767..1bfb2c01 100644 --- a/src/Nri/Ui/Modal/V11.elm +++ b/src/Nri/Ui/Modal/V11.elm @@ -162,7 +162,6 @@ import Accessibility.Styled.Aria as Aria import Accessibility.Styled.Key as Key import Accessibility.Styled.Role as Role import Accessibility.Styled.Widget as Widget -import Browser import Browser.Dom as Dom import Browser.Events import Css exposing (..) @@ -170,8 +169,7 @@ import Css.Media import Css.Transitions import Html.Styled as Root import Html.Styled.Attributes as Attrs exposing (id) -import Html.Styled.Events as Events exposing (onClick) -import Json.Decode as Decode exposing (Decoder) +import Html.Styled.Events exposing (onClick) import Nri.Ui.Colors.Extra import Nri.Ui.Colors.V1 as Colors import Nri.Ui.FocusTrap.V1 as FocusTrap exposing (FocusTrap) @@ -181,7 +179,6 @@ import Nri.Ui.MediaQuery.V1 exposing (mobile) import Nri.Ui.SpriteSheet import Nri.Ui.Svg.V1 import Task -import TransparentColor as Transparent {-| -} @@ -237,7 +234,6 @@ isOpen model = type Msg = CloseButtonClicked | EscOrOverlayClicked - | Focus String | Focused (Result Dom.Error ()) @@ -267,9 +263,6 @@ update { dismissOnEscAndOverlayClick } msg model = else ( model, Cmd.none ) - Focus id -> - ( model, Task.attempt Focused (Dom.focus id) ) - Focused _ -> -- TODO: consider adding error handling when we didn't successfully -- fous an element diff --git a/src/Nri/Ui/Palette/V1.elm b/src/Nri/Ui/Palette/V1.elm index 2604ac45..ba3c8edf 100644 --- a/src/Nri/Ui/Palette/V1.elm +++ b/src/Nri/Ui/Palette/V1.elm @@ -10,7 +10,7 @@ module Nri.Ui.Palette.V1 exposing -} -import Css exposing (..) +import Css import Nri.Ui.Colors.V1 as Colors diff --git a/src/Nri/Ui/PremiumCheckbox/V6.elm b/src/Nri/Ui/PremiumCheckbox/V6.elm index 40699e70..0ce20a1c 100644 --- a/src/Nri/Ui/PremiumCheckbox/V6.elm +++ b/src/Nri/Ui/PremiumCheckbox/V6.elm @@ -22,7 +22,7 @@ content to be "checked"! import Accessibility.Styled as Html exposing (Html) import Css -import Html.Styled.Attributes as Attributes exposing (css) +import Html.Styled.Attributes exposing (css) import Nri.Ui.Checkbox.V5 as Checkbox import Nri.Ui.Pennant.V2 exposing (premiumFlag) import Nri.Ui.Svg.V1 as Svg diff --git a/src/Nri/Ui/PremiumCheckbox/V7.elm b/src/Nri/Ui/PremiumCheckbox/V7.elm index c2211d83..25053bf5 100644 --- a/src/Nri/Ui/PremiumCheckbox/V7.elm +++ b/src/Nri/Ui/PremiumCheckbox/V7.elm @@ -32,7 +32,7 @@ module Nri.Ui.PremiumCheckbox.V7 exposing import Accessibility.Styled as Html exposing (Html) import Css -import Html.Styled.Attributes as Attributes exposing (css) +import Html.Styled.Attributes exposing (css) import Nri.Ui.Checkbox.V5 as Checkbox import Nri.Ui.Data.PremiumLevel as PremiumLevel exposing (PremiumLevel) import Nri.Ui.Pennant.V2 exposing (premiumFlag) diff --git a/src/Nri/Ui/RadioButton/V2.elm b/src/Nri/Ui/RadioButton/V2.elm index 9d5936c6..0ae0bda7 100644 --- a/src/Nri/Ui/RadioButton/V2.elm +++ b/src/Nri/Ui/RadioButton/V2.elm @@ -10,15 +10,12 @@ module Nri.Ui.RadioButton.V2 exposing (view, premium) -} import Accessibility.Styled exposing (..) -import Accessibility.Styled.Aria as Aria -import Accessibility.Styled.Style as Style import Accessibility.Styled.Widget as Widget import Css exposing (..) import Css.Global import Html.Styled as Html import Html.Styled.Attributes exposing (..) -import Html.Styled.Events exposing (onClick, stopPropagationOn) -import Json.Decode +import Html.Styled.Events exposing (onClick) import Nri.Ui.ClickableSvg.V2 as ClickableSvg import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Data.PremiumLevel as PremiumLevel exposing (PremiumLevel) @@ -26,7 +23,7 @@ import Nri.Ui.Fonts.V1 as Fonts import Nri.Ui.Html.Attributes.V2 as Attributes import Nri.Ui.Html.V3 exposing (viewIf) import Nri.Ui.Pennant.V2 as Pennant -import Nri.Ui.Svg.V1 exposing (Svg, fromHtml) +import Nri.Ui.Svg.V1 exposing (Svg) import String exposing (toLower) import String.Extra exposing (dasherize) import Svg.Styled as Svg @@ -234,19 +231,6 @@ internalView config = ] -onEnterAndSpacePreventDefault : msg -> Attribute msg -onEnterAndSpacePreventDefault msg = - Nri.Ui.Html.V3.onKeyUp - { stopPropagation = False, preventDefault = True } - (\code -> - if code == 13 || code == 32 then - Just msg - - else - Nothing - ) - - radioInputIcon : { isChecked : Bool , isLocked : Bool diff --git a/src/Nri/Ui/RadioButton/V3.elm b/src/Nri/Ui/RadioButton/V3.elm index eb62f13e..7a101df0 100644 --- a/src/Nri/Ui/RadioButton/V3.elm +++ b/src/Nri/Ui/RadioButton/V3.elm @@ -41,23 +41,20 @@ module Nri.Ui.RadioButton.V3 exposing import Accessibility.Styled exposing (..) import Accessibility.Styled.Aria as Aria -import Accessibility.Styled.Style as Style import Accessibility.Styled.Widget as Widget -import Css as Css exposing (..) +import Css exposing (..) import Css.Global import Html.Styled as Html import Html.Styled.Attributes as Attributes exposing (class, classList, css, for) -import Html.Styled.Events exposing (onClick, stopPropagationOn) +import Html.Styled.Events exposing (onClick) import InputErrorAndGuidanceInternal exposing (ErrorState, Guidance) -import Json.Decode import Nri.Ui.ClickableSvg.V2 as ClickableSvg import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Data.PremiumLevel as PremiumLevel exposing (PremiumLevel) import Nri.Ui.Fonts.V1 as Fonts import Nri.Ui.Html.Attributes.V2 as Extra -import Nri.Ui.Html.V3 exposing (viewJust) import Nri.Ui.Pennant.V2 as Pennant -import Nri.Ui.Svg.V1 exposing (Svg, fromHtml) +import Nri.Ui.Svg.V1 exposing (Svg) import String exposing (toLower) import String.Extra exposing (dasherize) import Svg.Styled as Svg @@ -259,13 +256,6 @@ applyConfig attributes beginningConfig = attributes -maybeAttr : (a -> Html.Attribute msg) -> Maybe a -> Html.Attribute msg -maybeAttr attr maybeValue = - maybeValue - |> Maybe.map attr - |> Maybe.withDefault Extra.none - - {-| View a single radio button. -} view : @@ -315,9 +305,6 @@ view { label, name, value, valueToString, selectedValue } attributes = isInError = InputErrorAndGuidanceInternal.getIsInError config.error - - errorMessage_ = - InputErrorAndGuidanceInternal.getErrorMessage config.error in Html.span [ Attributes.id (idValue ++ "-container") diff --git a/src/Nri/Ui/RadioButton/V4.elm b/src/Nri/Ui/RadioButton/V4.elm index a1cf05d0..2dbf5a16 100644 --- a/src/Nri/Ui/RadioButton/V4.elm +++ b/src/Nri/Ui/RadioButton/V4.elm @@ -40,7 +40,7 @@ module Nri.Ui.RadioButton.V4 exposing import Accessibility.Styled exposing (..) import Accessibility.Styled.Aria as Aria import Accessibility.Styled.Widget as Widget -import Css as Css exposing (..) +import Css exposing (..) import Css.Global import Html.Styled as Html import Html.Styled.Attributes as Attributes exposing (class, classList, css, for) diff --git a/src/Nri/Ui/SegmentedControl/V14.elm b/src/Nri/Ui/SegmentedControl/V14.elm index 8b54695a..d8b47457 100644 --- a/src/Nri/Ui/SegmentedControl/V14.elm +++ b/src/Nri/Ui/SegmentedControl/V14.elm @@ -18,18 +18,13 @@ import Accessibility.Styled exposing (..) import Accessibility.Styled.Aria as Aria import Accessibility.Styled.Role as Role import Accessibility.Styled.Style as Style -import Accessibility.Styled.Widget as Widget import Css exposing (..) -import EventExtras import Html.Styled -import Html.Styled.Attributes as Attributes exposing (css, href) +import Html.Styled.Attributes as Attributes exposing (css) import Html.Styled.Events as Events -import Json.Encode as Encode -import Nri.Ui import Nri.Ui.Colors.Extra exposing (withAlpha) import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Fonts.V1 as Fonts -import Nri.Ui.Html.Attributes.V2 as AttributesExtra import Nri.Ui.Svg.V1 as Svg exposing (Svg) import Nri.Ui.Tooltip.V2 as Tooltip import Nri.Ui.Util exposing (dashify) diff --git a/src/Nri/Ui/Select/V8.elm b/src/Nri/Ui/Select/V8.elm index 708c23a2..02808185 100644 --- a/src/Nri/Ui/Select/V8.elm +++ b/src/Nri/Ui/Select/V8.elm @@ -48,14 +48,13 @@ import Html.Styled.Attributes as Attributes exposing (css) import Html.Styled.Events as Events import InputErrorAndGuidanceInternal exposing (ErrorState, Guidance) import InputLabelInternal -import Json.Decode exposing (Decoder) +import Json.Decode import Nri.Ui import Nri.Ui.Colors.Extra as ColorsExtra import Nri.Ui.Colors.V1 as Colors import Nri.Ui.CssVendorPrefix.V1 as VendorPrefixed import Nri.Ui.Fonts.V1 as Fonts import Nri.Ui.Html.Attributes.V2 as Extra -import Nri.Ui.Html.V3 exposing (viewJust) import Nri.Ui.InputStyles.V3 as InputStyles import Nri.Ui.Util import SolidColor diff --git a/src/Nri/Ui/SideNav/V1.elm b/src/Nri/Ui/SideNav/V1.elm index a86c7c02..2094a639 100644 --- a/src/Nri/Ui/SideNav/V1.elm +++ b/src/Nri/Ui/SideNav/V1.elm @@ -36,9 +36,8 @@ import Accessibility.Styled exposing (..) import Accessibility.Styled.Style as Style import ClickableAttributes exposing (ClickableAttributes) import Css exposing (..) -import Css.Media as Media import Html.Styled -import Html.Styled.Attributes as Attributes exposing (css) +import Html.Styled.Attributes as Attributes import Html.Styled.Events as Events import Nri.Ui import Nri.Ui.ClickableText.V3 as ClickableText @@ -49,8 +48,6 @@ import Nri.Ui.Html.Attributes.V2 as ExtraAttributes import Nri.Ui.Html.V3 exposing (viewJust) import Nri.Ui.Svg.V1 as Svg exposing (Svg) import Nri.Ui.UiIcon.V1 as UiIcon -import String exposing (toLower) -import String.Extra exposing (dasherize) {-| Use `entry` to create a sidebar entry. diff --git a/src/Nri/Ui/SlideModal/V2.elm b/src/Nri/Ui/SlideModal/V2.elm index 8c2642e7..6191df60 100644 --- a/src/Nri/Ui/SlideModal/V2.elm +++ b/src/Nri/Ui/SlideModal/V2.elm @@ -20,12 +20,10 @@ import Accessibility.Styled.Widget as Widget import Css import Css.Animations import Css.Global -import Html.Styled import Html.Styled.Attributes exposing (css) import Html.Styled.Events exposing (onClick) import Html.Styled.Keyed as Keyed import Nri.Ui -import Nri.Ui.AssetPath exposing (Asset(..)) import Nri.Ui.Button.V10 as Button import Nri.Ui.Colors.Extra import Nri.Ui.Colors.V1 as Colors diff --git a/src/Nri/Ui/SortableTable/V2.elm b/src/Nri/Ui/SortableTable/V2.elm index 4fc811f6..05b08504 100644 --- a/src/Nri/Ui/SortableTable/V2.elm +++ b/src/Nri/Ui/SortableTable/V2.elm @@ -15,7 +15,6 @@ module Nri.Ui.SortableTable.V2 exposing -} import Css exposing (..) -import Css.Global exposing (Snippet, adjacentSiblings, children, class, descendants, each, everything, media, selector, withClass) import Html.Styled as Html exposing (Html) import Html.Styled.Attributes exposing (css) import Html.Styled.Events @@ -24,7 +23,7 @@ import Nri.Ui.Colors.V1 import Nri.Ui.CssVendorPrefix.V1 as CssVendorPrefix import Nri.Ui.Table.V5 import SolidColor -import Svg.Styled as Svg exposing (Svg) +import Svg.Styled as Svg import Svg.Styled.Attributes as SvgAttributes diff --git a/src/Nri/Ui/Tabs/V6.elm b/src/Nri/Ui/Tabs/V6.elm index 656c1bcd..59af7c20 100644 --- a/src/Nri/Ui/Tabs/V6.elm +++ b/src/Nri/Ui/Tabs/V6.elm @@ -16,7 +16,7 @@ module Nri.Ui.Tabs.V6 exposing -} import Css exposing (..) -import Html.Styled as Html exposing (Attribute, Html) +import Html.Styled as Html exposing (Html) import Html.Styled.Attributes as Attributes import Nri.Ui import Nri.Ui.Colors.Extra exposing (withAlpha) diff --git a/src/Nri/Ui/Tabs/V7.elm b/src/Nri/Ui/Tabs/V7.elm index 73c1ce4b..dbe946f4 100644 --- a/src/Nri/Ui/Tabs/V7.elm +++ b/src/Nri/Ui/Tabs/V7.elm @@ -22,7 +22,6 @@ module Nri.Ui.Tabs.V7 exposing -} -import Accessibility.Styled.Aria as Aria import Css exposing (..) import Html.Styled as Html exposing (Html) import Html.Styled.Attributes as Attributes diff --git a/src/Nri/Ui/Text/V6.elm b/src/Nri/Ui/Text/V6.elm index 0c4c4b2f..55adb9c7 100644 --- a/src/Nri/Ui/Text/V6.elm +++ b/src/Nri/Ui/Text/V6.elm @@ -54,7 +54,7 @@ You're in the wrong place! Headings live in Nri.Ui.Heading.V2. import Accessibility.Styled as Html exposing (..) import Css exposing (..) -import Css.Global exposing (a, descendants) +import Css.Global import Html.Styled.Attributes as Attributes import Markdown import Nri.Ui.Colors.V1 exposing (..) diff --git a/src/Nri/Ui/TextArea/V4.elm b/src/Nri/Ui/TextArea/V4.elm index ea7ddec2..2722d1e8 100644 --- a/src/Nri/Ui/TextArea/V4.elm +++ b/src/Nri/Ui/TextArea/V4.elm @@ -24,7 +24,7 @@ custom element, or else autosizing will break! This means doing the following: -} import Accessibility.Styled.Style -import Css exposing (plus, px) +import Css exposing (px) import Html.Styled as Html exposing (Html) import Html.Styled.Attributes as Attributes import Html.Styled.Events as Events @@ -32,8 +32,6 @@ import Nri.Ui.Html.Attributes.V2 as Extra import Nri.Ui.InputStyles.V3 as InputStyles exposing ( Theme(..) - , input - , label ) import Nri.Ui.Util exposing (dashify, removePunctuation) diff --git a/src/Nri/Ui/TextInput/V7.elm b/src/Nri/Ui/TextInput/V7.elm index 9868a846..1d0f2854 100644 --- a/src/Nri/Ui/TextInput/V7.elm +++ b/src/Nri/Ui/TextInput/V7.elm @@ -51,8 +51,6 @@ module Nri.Ui.TextInput.V7 exposing -} -import Accessibility.Styled.Aria as Aria -import Accessibility.Styled.Style as Accessibility import Css exposing (center, num, position, px, relative, textAlign) import Css.Global import Html.Styled as Html exposing (..) @@ -60,12 +58,11 @@ import Html.Styled.Attributes as Attributes exposing (..) import Html.Styled.Events as Events import InputErrorAndGuidanceInternal exposing (ErrorState, Guidance) import InputLabelInternal -import Keyboard.Event exposing (KeyboardEvent) +import Keyboard.Event import Nri.Ui.ClickableSvg.V2 as ClickableSvg import Nri.Ui.ClickableText.V3 as ClickableText import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Html.Attributes.V2 as Extra -import Nri.Ui.Html.V3 exposing (viewJust) import Nri.Ui.InputStyles.V3 as InputStyles exposing (defaultMarginTop) import Nri.Ui.Svg.V1 as Svg import Nri.Ui.UiIcon.V1 as UiIcon @@ -585,9 +582,6 @@ view label attributes = isInError = InputErrorAndGuidanceInternal.getIsInError config.error - errorMessage_ = - InputErrorAndGuidanceInternal.getErrorMessage config.error - ( opacity, disabled_ ) = case ( config.disabled, config.loading ) of ( False, False ) -> diff --git a/src/Nri/Ui/Tooltip/V1.elm b/src/Nri/Ui/Tooltip/V1.elm index 5514baa5..686b7cbb 100644 --- a/src/Nri/Ui/Tooltip/V1.elm +++ b/src/Nri/Ui/Tooltip/V1.elm @@ -55,7 +55,7 @@ Example usage: -} -import Accessibility.Styled as Html exposing (Attribute, Html, text) +import Accessibility.Styled as Html exposing (Attribute, Html) import Accessibility.Styled.Aria as Aria import Accessibility.Styled.Role as Role import Accessibility.Styled.Widget as Widget diff --git a/tests/Spec/Nri/Ui/Page.elm b/tests/Spec/Nri/Ui/Page.elm index a9db04d8..076b9ed9 100644 --- a/tests/Spec/Nri/Ui/Page.elm +++ b/tests/Spec/Nri/Ui/Page.elm @@ -1,6 +1,6 @@ module Spec.Nri.Ui.Page exposing (all) -import Expect exposing (Expectation) +import Expect import Html.Styled as Html import Nri.Ui.Page.V3 as Page import Test exposing (..) diff --git a/tests/Spec/Nri/Ui/PremiumCheckbox.elm b/tests/Spec/Nri/Ui/PremiumCheckbox.elm index 6f102676..3d04d96c 100644 --- a/tests/Spec/Nri/Ui/PremiumCheckbox.elm +++ b/tests/Spec/Nri/Ui/PremiumCheckbox.elm @@ -2,7 +2,7 @@ module Spec.Nri.Ui.PremiumCheckbox exposing (spec) import Html.Attributes as Attributes import Html.Styled -import Nri.Ui.Checkbox.V5 as Checkbox exposing (IsSelected(..)) +import Nri.Ui.Checkbox.V5 exposing (IsSelected(..)) import Nri.Ui.PremiumCheckbox.V6 as PremiumCheckbox import Test exposing (..) import Test.Html.Event as Event diff --git a/tests/Spec/Nri/Ui/SortableTable.elm b/tests/Spec/Nri/Ui/SortableTable.elm index 3b8cc7e3..bbcc4e76 100644 --- a/tests/Spec/Nri/Ui/SortableTable.elm +++ b/tests/Spec/Nri/Ui/SortableTable.elm @@ -1,6 +1,6 @@ module Spec.Nri.Ui.SortableTable exposing (spec) -import Expect exposing (Expectation) +import Expect import Html.Styled import Nri.Ui.SortableTable.V2 as SortableTable import Test exposing (..) @@ -11,7 +11,6 @@ import Test.Html.Selector as Selector type Column = FirstName | LastName - | Coins type alias Person = diff --git a/tests/Spec/Nri/Ui/Tooltip.elm b/tests/Spec/Nri/Ui/Tooltip.elm index 03a9060b..9d4ed129 100644 --- a/tests/Spec/Nri/Ui/Tooltip.elm +++ b/tests/Spec/Nri/Ui/Tooltip.elm @@ -2,8 +2,6 @@ module Spec.Nri.Ui.Tooltip exposing (spec) import Accessibility.Aria as Aria import Accessibility.Widget as Widget -import Expect -import Html import Html.Attributes as Attributes import Html.Styled as HtmlStyled import Nri.Ui.Tooltip.V2 as Tooltip From 7d457f3b4d7a87e5c5a7198e98c961d24dd78b1b Mon Sep 17 00:00:00 2001 From: Ju Liu <ju@noredink.com> Date: Tue, 15 Mar 2022 17:26:55 +0000 Subject: [PATCH 3/7] elm-review runs cleanly --- elm.json | 2 +- review/src/ReviewConfig.elm | 4 +- shell.nix | 1 + src/Nri/Ui/AssetPath/Css.elm | 17 -- src/Nri/Ui/CssFlexBoxWithVendorPrefix.elm | 269 ---------------------- src/Nri/Ui/DatePickerConstants.elm | 35 --- 6 files changed, 5 insertions(+), 323 deletions(-) delete mode 100644 src/Nri/Ui/AssetPath/Css.elm delete mode 100644 src/Nri/Ui/CssFlexBoxWithVendorPrefix.elm delete mode 100644 src/Nri/Ui/DatePickerConstants.elm diff --git a/elm.json b/elm.json index 63a696a1..fede6ed0 100644 --- a/elm.json +++ b/elm.json @@ -78,7 +78,6 @@ "Gizra/elm-keyboard-event": "1.0.1 <= v < 2.0.0", "elm/browser": "1.0.2 <= v < 2.0.0", "elm/core": "1.0.1 <= v < 2.0.0", - "elm/html": "1.0.0 <= v < 2.0.0", "elm/http": "2.0.0 <= v < 3.0.0", "elm/json": "1.1.3 <= v < 2.0.0", "elm/random": "1.0.0 <= v < 2.0.0", @@ -93,6 +92,7 @@ }, "test-dependencies": { "avh4/elm-program-test": "3.3.0 <= v < 4.0.0", + "elm/html": "1.0.0 <= v < 2.0.0", "elm-explorations/test": "1.2.2 <= v < 2.0.0", "tesk9/accessible-html": "4.1.0 <= v < 5.0.0" } diff --git a/review/src/ReviewConfig.elm b/review/src/ReviewConfig.elm index 58e8cc0f..03fadcf9 100644 --- a/review/src/ReviewConfig.elm +++ b/review/src/ReviewConfig.elm @@ -25,7 +25,9 @@ import Review.Rule exposing (Rule) config : List Rule config = [ NoUnused.CustomTypeConstructors.rule [] - , NoUnused.CustomTypeConstructorArgs.rule + + -- sometimes we just want to build a value without extracting it + -- , NoUnused.CustomTypeConstructorArgs.rule , NoUnused.Dependencies.rule -- We want to include all functions even if they're unused in this repository. diff --git a/shell.nix b/shell.nix index 1505abcd..32a0a494 100644 --- a/shell.nix +++ b/shell.nix @@ -29,6 +29,7 @@ stdenv.mkDerivation { elmPackages.elm-test elmPackages.elm-verify-examples elmPackages.elm-review + elmPackages.elm-json (pkgs.callPackage sources.elm-forbid-import { }) # preview dependencies diff --git a/src/Nri/Ui/AssetPath/Css.elm b/src/Nri/Ui/AssetPath/Css.elm deleted file mode 100644 index 2369069f..00000000 --- a/src/Nri/Ui/AssetPath/Css.elm +++ /dev/null @@ -1,17 +0,0 @@ -module Nri.Ui.AssetPath.Css exposing (url) - -{-| Helper for constructing commonly-used CSS functions -that reference assets. - -@docs url - --} - -import Nri.Ui.AssetPath as AssetPath exposing (Asset) - - -{-| Given an `Asset`, wrap its URL in a call to `url()`. --} -url : Asset -> String -url asset = - "url(" ++ AssetPath.url asset ++ ")" diff --git a/src/Nri/Ui/CssFlexBoxWithVendorPrefix.elm b/src/Nri/Ui/CssFlexBoxWithVendorPrefix.elm deleted file mode 100644 index cc5b576f..00000000 --- a/src/Nri/Ui/CssFlexBoxWithVendorPrefix.elm +++ /dev/null @@ -1,269 +0,0 @@ -module Nri.Ui.CssFlexBoxWithVendorPrefix exposing - ( displayFlex, displayInlineFlex, flexDirection, justifyContent, alignItems, alignSelf, flexBasis - , flexGrow, flexShrink, row, rowReverse, column, columnReverse, flexStart, flexEnd, baseline, stretch, center, spaceBetween, spaceAround, flexWrap, nowrap, wrap, wrapReverse - ) - -{-| - -@docs displayFlex, displayInlineFlex, flexDirection, justifyContent, alignItems, alignSelf, flexBasis -@docs flexGrow, flexShrink, row, rowReverse, column, columnReverse, flexStart, flexEnd, baseline, stretch, center, spaceBetween, spaceAround, flexWrap, nowrap, wrap, wrapReverse - --} - -import Css exposing (Style, batch, property) - - -{-| -} -displayFlex : Style -displayFlex = - batch - [ property "display" "-webkit-box" -- OLD - iOS 6-, Safari 3.1-6 - , property "display" "-moz-box" -- OLD - Firefox 19- (buggy but mostly works) - , property "display" "-ms-flexbox" -- TWEENER - IE 10 - , property "display" "-webkit-flex" -- NEW - Chrome - , property "display" "flex" -- NEW, Spec - Opera 12.1, Firefox 20+ - ] - - -{-| -} -displayInlineFlex : Style -displayInlineFlex = - batch - [ property "display" "-webkit-inline-box" -- OLD - iOS 6-, Safari 3.1-6 - , property "display" "-moz-inline-box" -- OLD - Firefox 19- (buggy but mostly works) - , property "display" "-ms-inline-flexbox" -- TWEENER - IE 10 - , property "display" "-webkit-inline-flex" -- NEW - Chrome - , property "display" "inline-flex" -- NEW, Spec - Opera 12.1, Firefox 20+ - ] - - -{-| -} -flexDirection : Direction -> Style -flexDirection direction = - addPrefix "flex-direction" <| - case direction of - Row -> - "row" - - RowReverse -> - "row-reverse" - - Column -> - "column" - - ColumnReverse -> - "column-reverse" - - -type Direction - = Row - | RowReverse - | Column - | ColumnReverse - - -{-| Direction row. --} -row : Direction -row = - Row - - -{-| Direction rowReverse. --} -rowReverse : Direction -rowReverse = - RowReverse - - -{-| Direction column. --} -column : Direction -column = - Column - - -{-| Direction columnReverse. --} -columnReverse : Direction -columnReverse = - ColumnReverse - - -{-| -} -justifyContent : Alignment JustifyContent a -> Style -justifyContent = - addPrefix "justify-content" << alignmentToString - - -{-| -} -alignItems : Alignment a AlignItems -> Style -alignItems = - addPrefix "align-items" << alignmentToString - - -{-| -} -alignSelf : Alignment a AlignItems -> Style -alignSelf = - addPrefix "align-self" << alignmentToString - - -{-| -} -flexBasis : Css.Length compatible units -> Style -flexBasis = - addPrefix "flex-basis" << .value - - -{-| -} -flexGrow : Float -> Style -flexGrow value = - addPrefix "flex-grow" (toString value) - - -{-| -} -flexShrink : Float -> Style -flexShrink value = - addPrefix "flex-shrink" (toString value) - - -{-| -} -flexWrap : Wrap -> Style -flexWrap value = - addPrefix "flex-wrap" <| - case value of - Nowrap -> - "nowrap" - - Wrap -> - "wrap" - - WrapReverse -> - "wrap-reverse" - - -type Wrap - = Nowrap - | Wrap - | WrapReverse - - -{-| flex-wrap nowrap --} -nowrap : Wrap -nowrap = - Nowrap - - -{-| flex-wrap wrap --} -wrap : Wrap -wrap = - Wrap - - -{-| flex-wrap wrapReverse --} -wrapReverse : Wrap -wrapReverse = - WrapReverse - - -type Alignment justify align - = FlexStart justify align - | FlexEnd justify align - | Center justify align - | SpaceBetween justify - | SpaceAround justify - | Baseline align - | Stretch align - - -alignmentToString : Alignment a b -> String -alignmentToString value = - case value of - FlexStart _ _ -> - "flex-start" - - FlexEnd _ _ -> - "flex-end" - - Center _ _ -> - "center" - - SpaceBetween _ -> - "space-between" - - SpaceAround _ -> - "space-around" - - Baseline _ -> - "baseline" - - Stretch _ -> - "stretch" - - -type JustifyContent - = JustifyContent - - -type AlignItems - = AlignItems - - -{-| align-items/justify-content flexStart --} -flexStart : Alignment JustifyContent AlignItems -flexStart = - FlexStart JustifyContent AlignItems - - -{-| align-items/justify-content flexEnd --} -flexEnd : Alignment JustifyContent AlignItems -flexEnd = - FlexEnd JustifyContent AlignItems - - -{-| align-items/justify-content center --} -center : Alignment JustifyContent AlignItems -center = - Center JustifyContent AlignItems - - -{-| justify-content spaceBetween --} -spaceBetween : Alignment JustifyContent Never -spaceBetween = - SpaceBetween JustifyContent - - -{-| justify-content spaceAround --} -spaceAround : Alignment JustifyContent Never -spaceAround = - SpaceAround JustifyContent - - -{-| align-items baseline --} -baseline : Alignment Never AlignItems -baseline = - Baseline AlignItems - - -{-| align-items stretch --} -stretch : Alignment Never AlignItems -stretch = - Stretch AlignItems - - -addPrefix : String -> String -> Style -addPrefix propertyName value = - batch - [ property ("-webkit-" ++ propertyName) value - , property propertyName value - , property ("-ms-" ++ propertyName) value - ] diff --git a/src/Nri/Ui/DatePickerConstants.elm b/src/Nri/Ui/DatePickerConstants.elm deleted file mode 100644 index a75ef726..00000000 --- a/src/Nri/Ui/DatePickerConstants.elm +++ /dev/null @@ -1,35 +0,0 @@ -module Nri.Ui.DatePickerConstants exposing - ( datePickerTag - , dialogTag - , footerTag - ) - -{-| - -@docs datePickerTag -@docs dialogTag -@docs footerTag - --} - - -{-| The class of the entire date picker --} -datePickerTag : String -datePickerTag = - "date-time-picker" - - -{-| The class of just the dialog that shows up when you open the datepicker --} -dialogTag : String -dialogTag = - "date-time-picker-dialog" - - -{-| The class of the footer in the dialog. -This is where the pretty-printed date is displayed. --} -footerTag : String -footerTag = - "date-time-picker-footer" From 3b2e2a12f85b5ebf4e495894aee894e360764c0f Mon Sep 17 00:00:00 2001 From: Ju Liu <ju@noredink.com> Date: Tue, 15 Mar 2022 17:29:20 +0000 Subject: [PATCH 4/7] Add shake rule to run elm-review --- Shakefile.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Shakefile.hs b/Shakefile.hs index 35911b05..af9e832d 100644 --- a/Shakefile.hs +++ b/Shakefile.hs @@ -48,6 +48,7 @@ main = do "tests/elm-verify-examples.json", "log/elm-verify-examples.txt", "log/elm-test.txt", + "log/elm-review.txt", "log/axe-report.txt", "log/percy-tests.txt", "log/forbidden-imports-report.txt", @@ -83,6 +84,11 @@ main = do need (["package.json", "elm.json"] ++ elmFiles) cmd (WithStdout True) (FileStdout out) "elm-test" + "log/elm-review.txt" %> \out -> do + elmFiles <- getDirectoryFiles "." ["**/*.elm"] + need (["package.json", "elm.json"] ++ elmFiles) + cmd (WithStdout True) (FileStdout out) "elm-review" + "log/elm-verify-examples.txt" %> \out -> do elmFiles <- getDirectoryFiles "." ["src/**/*.elm"] need (["tests/elm-verify-examples.json"] ++ elmFiles) From b7f6ff13ea919ab0374fc798c454b85872f5035e Mon Sep 17 00:00:00 2001 From: Ju Liu <ju@noredink.com> Date: Tue, 15 Mar 2022 17:58:21 +0000 Subject: [PATCH 5/7] Add elm-review to styleguide app --- styleguide-app/review/elm.json | 35 ++++++++++++++++++++ styleguide-app/review/src/ReviewConfig.elm | 38 ++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 styleguide-app/review/elm.json create mode 100644 styleguide-app/review/src/ReviewConfig.elm diff --git a/styleguide-app/review/elm.json b/styleguide-app/review/elm.json new file mode 100644 index 00000000..b85f1ad9 --- /dev/null +++ b/styleguide-app/review/elm.json @@ -0,0 +1,35 @@ +{ + "type": "application", + "source-directories": [ + "src" + ], + "elm-version": "0.19.1", + "dependencies": { + "direct": { + "elm/core": "1.0.5", + "elm/json": "1.1.3", + "elm/project-metadata-utils": "1.0.2", + "jfmengels/elm-review": "2.7.0", + "jfmengels/elm-review-unused": "1.1.20", + "stil4m/elm-syntax": "7.2.9" + }, + "indirect": { + "elm/html": "1.0.0", + "elm/parser": "1.1.0", + "elm/random": "1.0.0", + "elm/time": "1.0.0", + "elm/virtual-dom": "1.0.2", + "elm-community/list-extra": "8.5.2", + "elm-explorations/test": "1.2.2", + "miniBill/elm-unicode": "1.0.2", + "rtfeldman/elm-hex": "1.0.0", + "stil4m/structured-writer": "1.0.3" + } + }, + "test-dependencies": { + "direct": { + "elm-explorations/test": "1.2.2" + }, + "indirect": {} + } +} diff --git a/styleguide-app/review/src/ReviewConfig.elm b/styleguide-app/review/src/ReviewConfig.elm new file mode 100644 index 00000000..696f1fa1 --- /dev/null +++ b/styleguide-app/review/src/ReviewConfig.elm @@ -0,0 +1,38 @@ +module ReviewConfig exposing (config) + +{-| Do not rename the ReviewConfig module or the config function, because +`elm-review` will look for these. + +To add packages that contain rules, add them to this review project using + + `elm install author/packagename` + +when inside the directory containing this file. + +-} + +import NoUnused.CustomTypeConstructors +import NoUnused.Exports +import NoUnused.Modules +import NoUnused.Variables +import Review.Rule exposing (Rule) + + +config : List Rule +config = + List.map + (Review.Rule.ignoreErrorsForDirectories [ "../src" ]) + [ NoUnused.CustomTypeConstructors.rule [] + + -- sometimes we just want to build a value without extracting it + -- , NoUnused.CustomTypeConstructorArgs.rule + -- this rules is not useful in here + -- , NoUnused.Dependencies.rule + , NoUnused.Exports.rule + , NoUnused.Modules.rule + + -- We like to keep parameters around for readability. + -- , NoUnused.Parameters.rule + -- , NoUnused.Patterns.rule + , NoUnused.Variables.rule + ] From efaee1b7af1a3868d577e905e7c70970a4e9a17a Mon Sep 17 00:00:00 2001 From: Ju Liu <ju@noredink.com> Date: Tue, 15 Mar 2022 18:06:13 +0000 Subject: [PATCH 6/7] Apply elm-review in styleguide app --- styleguide-app/CommonControls.elm | 16 +++------------- styleguide-app/Example.elm | 5 ++--- styleguide-app/Examples/Accordion.elm | 3 +-- styleguide-app/Examples/AssignmentIcon.elm | 1 - styleguide-app/Examples/Balloon.elm | 5 +---- styleguide-app/Examples/Button.elm | 14 ++------------ styleguide-app/Examples/Checkbox.elm | 4 ++-- styleguide-app/Examples/ClickableSvg.elm | 17 ++--------------- styleguide-app/Examples/ClickableText.elm | 10 ++-------- styleguide-app/Examples/Colors.elm | 2 -- styleguide-app/Examples/Confetti.elm | 5 ----- styleguide-app/Examples/Container.elm | 4 ---- .../Examples/DisclosureIndicator.elm | 3 --- styleguide-app/Examples/Divider.elm | 4 ---- styleguide-app/Examples/Fonts.elm | 1 - styleguide-app/Examples/Heading.elm | 1 - styleguide-app/Examples/IconExamples.elm | 2 +- styleguide-app/Examples/Loading.elm | 3 --- styleguide-app/Examples/Logo.elm | 3 +-- styleguide-app/Examples/Menu.elm | 19 +++---------------- styleguide-app/Examples/Message.elm | 6 ++---- styleguide-app/Examples/Modal.elm | 6 ++---- styleguide-app/Examples/Page.elm | 8 +------- styleguide-app/Examples/Pennant.elm | 7 +------ styleguide-app/Examples/RadioButton.elm | 5 ++--- styleguide-app/Examples/SegmentedControl.elm | 5 ++--- styleguide-app/Examples/Select.elm | 8 +------- styleguide-app/Examples/Shadows.elm | 2 +- styleguide-app/Examples/SideNav.elm | 9 +-------- styleguide-app/Examples/SlideModal.elm | 3 +-- styleguide-app/Examples/SortableTable.elm | 7 +------ styleguide-app/Examples/Sprite.elm | 2 -- styleguide-app/Examples/Svg.elm | 3 --- styleguide-app/Examples/Table.elm | 1 - styleguide-app/Examples/Tabs.elm | 3 +-- styleguide-app/Examples/Text.elm | 5 ++--- styleguide-app/Examples/Text/Writing.elm | 1 - styleguide-app/Examples/TextArea.elm | 2 -- styleguide-app/Examples/TextInput.elm | 6 +----- styleguide-app/Examples/Tooltip.elm | 2 -- styleguide-app/Examples/UiIcon.elm | 1 - styleguide-app/KeyboardSupport.elm | 2 +- styleguide-app/Main.elm | 17 +++++------------ styleguide-app/Routes.elm | 1 - styleguide-app/ViewHelpers.elm | 2 +- 45 files changed, 46 insertions(+), 190 deletions(-) diff --git a/styleguide-app/CommonControls.elm b/styleguide-app/CommonControls.elm index 8184ebf5..4d2e67c8 100644 --- a/styleguide-app/CommonControls.elm +++ b/styleguide-app/CommonControls.elm @@ -3,8 +3,8 @@ module CommonControls exposing , choice , icon, iconNotCheckedByDefault, uiIcon , content - , quickBrownFox, longPangrams, romeoAndJulietQuotation, markdown, exampleHtml, httpError - , disabledListItem, premiumDisplay, premiumLevel + , romeoAndJulietQuotation, httpError + , disabledListItem, premiumDisplay ) {-| @@ -17,7 +17,7 @@ module CommonControls exposing ### Content @docs content -@docs quickBrownFox, longPangrams, romeoAndJulietQuotation, markdown, exampleHtml, httpError +@docs romeoAndJulietQuotation, httpError -} @@ -25,24 +25,14 @@ import Css import Debug.Control as Control exposing (Control) import Debug.Control.Extra as ControlExtra import Html.Styled as Html exposing (Html) -import Html.Styled.Attributes as Attributes import Http import Nri.Ui.ClickableText.V3 as ClickableText import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Data.PremiumDisplay as PremiumDisplay exposing (PremiumDisplay) -import Nri.Ui.Data.PremiumLevel exposing (PremiumLevel(..)) import Nri.Ui.Svg.V1 exposing (Svg) import Nri.Ui.UiIcon.V1 as UiIcon -premiumLevel : Control ( String, PremiumLevel ) -premiumLevel = - choice "PremiumLevel" - [ ( "Free", Free ) - , ( "PremiumWithWriting", PremiumWithWriting ) - ] - - premiumDisplay : Control ( String, PremiumDisplay ) premiumDisplay = Control.choice diff --git a/styleguide-app/Example.elm b/styleguide-app/Example.elm index 126a1ed1..e42c1195 100644 --- a/styleguide-app/Example.elm +++ b/styleguide-app/Example.elm @@ -2,7 +2,7 @@ module Example exposing (Example, preview, view, wrapMsg, wrapState) import Category exposing (Category) import Css exposing (..) -import Css.Global exposing (a, descendants) +import Css.Global exposing (descendants) import Html.Styled as Html exposing (Html) import Html.Styled.Attributes as Attributes import Html.Styled.Events as Events @@ -10,11 +10,10 @@ import Html.Styled.Lazy as Lazy import KeyboardSupport exposing (KeyboardSupport) import Nri.Ui.ClickableSvg.V2 as ClickableSvg import Nri.Ui.ClickableText.V3 as ClickableText -import Nri.Ui.Colors.V1 as Colors exposing (..) +import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Container.V2 as Container import Nri.Ui.Fonts.V1 as Fonts import Nri.Ui.Heading.V2 as Heading -import Nri.Ui.Html.Attributes.V2 as AttributeExtras exposing (targetBlank) import Nri.Ui.UiIcon.V1 as UiIcon import Routes exposing (Route) diff --git a/styleguide-app/Examples/Accordion.elm b/styleguide-app/Examples/Accordion.elm index 088ce90a..6c69bf97 100644 --- a/styleguide-app/Examples/Accordion.elm +++ b/styleguide-app/Examples/Accordion.elm @@ -17,12 +17,11 @@ import Css exposing (..) import Css.Global import Example exposing (Example) import Html.Styled.Attributes as Attributes exposing (css, src) -import KeyboardSupport exposing (Direction(..), Key(..)) +import KeyboardSupport exposing (Key(..)) import Nri.Ui.Accordion.V3 as Accordion exposing (AccordionEntry(..)) import Nri.Ui.Colors.Extra as ColorsExtra import Nri.Ui.Colors.V1 as Colors import Nri.Ui.DisclosureIndicator.V2 as DisclosureIndicator -import Nri.Ui.Fonts.V1 as Fonts import Nri.Ui.Heading.V2 as Heading import Nri.Ui.Svg.V1 as Svg import Nri.Ui.Text.V6 as Text diff --git a/styleguide-app/Examples/AssignmentIcon.elm b/styleguide-app/Examples/AssignmentIcon.elm index e5b5b57c..98f82ded 100644 --- a/styleguide-app/Examples/AssignmentIcon.elm +++ b/styleguide-app/Examples/AssignmentIcon.elm @@ -9,7 +9,6 @@ module Examples.AssignmentIcon exposing (example, State, Msg) import Category exposing (Category(..)) import Example exposing (Example) import Examples.IconExamples as IconExamples -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.AssignmentIcon.V2 as AssignmentIcon diff --git a/styleguide-app/Examples/Balloon.elm b/styleguide-app/Examples/Balloon.elm index 9ba1a24a..9d8a5842 100644 --- a/styleguide-app/Examples/Balloon.elm +++ b/styleguide-app/Examples/Balloon.elm @@ -11,12 +11,9 @@ import Css import Debug.Control as Control exposing (Control) import Debug.Control.Extra as ControlExtra import Example exposing (Example) -import Examples.IconExamples as IconExamples -import Html.Styled exposing (Html, div, fromUnstyled, text) +import Html.Styled exposing (Html, fromUnstyled, text) import Html.Styled.Attributes exposing (css) -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.Balloon.V1 as Balloon -import Nri.Ui.Colors.V1 as Colors {-| -} diff --git a/styleguide-app/Examples/Button.elm b/styleguide-app/Examples/Button.elm index 00b33a0f..7e840a77 100644 --- a/styleguide-app/Examples/Button.elm +++ b/styleguide-app/Examples/Button.elm @@ -15,11 +15,9 @@ import Debug.Control.Extra as ControlExtra import Debug.Control.View as ControlView import Example exposing (Example) import Html.Styled exposing (..) -import Html.Styled.Attributes exposing (css, id) -import KeyboardSupport exposing (Direction(..), Key(..)) +import Html.Styled.Attributes exposing (css) import Nri.Ui.Button.V10 as Button import Nri.Ui.Heading.V2 as Heading -import Nri.Ui.Svg.V1 as Svg exposing (Svg) import Nri.Ui.UiIcon.V1 as UiIcon import Set exposing (Set) @@ -88,7 +86,6 @@ type Msg = SetDebugControlsState (Control Model) | ShowItWorked String String | ToggleToggleButton Int - | NoOp {-| -} @@ -101,11 +98,7 @@ update msg state = ) ShowItWorked group message -> - let - _ = - Debug.log group message - in - ( state, Cmd.none ) + ( Debug.log group message |> always state, Cmd.none ) ToggleToggleButton id -> ( { state @@ -119,9 +112,6 @@ update msg state = , Cmd.none ) - NoOp -> - ( state, Cmd.none ) - -- INTERNAL diff --git a/styleguide-app/Examples/Checkbox.elm b/styleguide-app/Examples/Checkbox.elm index a6751307..543fc9f6 100644 --- a/styleguide-app/Examples/Checkbox.elm +++ b/styleguide-app/Examples/Checkbox.elm @@ -11,9 +11,9 @@ import Css import Example exposing (Example) import Html.Styled as Html exposing (..) import Html.Styled.Attributes exposing (css) -import KeyboardSupport exposing (Direction(..), Key(..)) +import KeyboardSupport exposing (Key(..)) import Nri.Ui.Checkbox.V5 as Checkbox -import Nri.Ui.Data.PremiumDisplay as PremiumDisplay exposing (PremiumDisplay) +import Nri.Ui.Data.PremiumDisplay as PremiumDisplay import Nri.Ui.PremiumCheckbox.V8 as PremiumCheckbox import Set exposing (Set) diff --git a/styleguide-app/Examples/ClickableSvg.elm b/styleguide-app/Examples/ClickableSvg.elm index 105fe4b8..28e1847b 100644 --- a/styleguide-app/Examples/ClickableSvg.elm +++ b/styleguide-app/Examples/ClickableSvg.elm @@ -15,16 +15,11 @@ import Debug.Control.Extra as ControlExtra import Debug.Control.View as ControlView import EventExtras import Example exposing (Example) -import Examples.IconExamples as IconExamples import Html.Styled as Html exposing (Html) import Html.Styled.Attributes as Attributes -import Html.Styled.Events as Events -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.ClickableSvg.V2 as ClickableSvg -import Nri.Ui.Colors.Extra exposing (fromCssColor, toCssColor) import Nri.Ui.Colors.V1 as Colors -import Nri.Ui.Heading.V2 as Heading -import Nri.Ui.Svg.V1 as Svg exposing (Svg) +import Nri.Ui.Svg.V1 exposing (Svg) import Nri.Ui.Tooltip.V2 as Tooltip import Nri.Ui.UiIcon.V1 as UiIcon @@ -231,7 +226,6 @@ init = type Msg = ShowItWorked String | SetPreviewTooltip Bool - | SetShareTooltip Bool | SetControls (Control (Settings Msg)) @@ -240,18 +234,11 @@ update : Msg -> State -> ( State, Cmd Msg ) update msg state = case msg of ShowItWorked message -> - let - _ = - Debug.log "ClickableSvg" message - in - ( state, Cmd.none ) + ( Debug.log "ClickableSvg" message |> always state, Cmd.none ) SetPreviewTooltip bool -> ( { state | tooltipPreview = bool }, Cmd.none ) - SetShareTooltip bool -> - ( { state | tooltipShareTo = bool }, Cmd.none ) - SetControls settings -> ( { state | settings = settings }, Cmd.none ) diff --git a/styleguide-app/Examples/ClickableText.elm b/styleguide-app/Examples/ClickableText.elm index 33723d1c..443a7076 100644 --- a/styleguide-app/Examples/ClickableText.elm +++ b/styleguide-app/Examples/ClickableText.elm @@ -15,10 +15,8 @@ import Debug.Control.Extra as ControlExtra import Debug.Control.View as ControlView import Example exposing (Example) import Html.Styled exposing (..) -import Html.Styled.Attributes exposing (css, id) -import KeyboardSupport exposing (Direction(..), Key(..)) +import Html.Styled.Attributes exposing (css) import Nri.Ui.ClickableText.V3 as ClickableText -import Nri.Ui.Svg.V1 as Svg exposing (Svg) import Nri.Ui.Text.V6 as Text import Nri.Ui.UiIcon.V1 as UiIcon @@ -111,11 +109,7 @@ update msg state = ( State controls, Cmd.none ) ShowItWorked group message -> - let - _ = - Debug.log group message - in - ( state, Cmd.none ) + ( Debug.log group message |> always state, Cmd.none ) diff --git a/styleguide-app/Examples/Colors.elm b/styleguide-app/Examples/Colors.elm index 830f6101..c598df2f 100644 --- a/styleguide-app/Examples/Colors.elm +++ b/styleguide-app/Examples/Colors.elm @@ -11,10 +11,8 @@ import Css import Example exposing (Example) import Html.Styled as Html import Html.Styled.Attributes as Attributes exposing (css) -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.Colors.Extra import Nri.Ui.Colors.V1 as Colors -import Nri.Ui.Fonts.V1 as Fonts import Nri.Ui.Heading.V2 as Heading import SolidColor exposing (highContrast) diff --git a/styleguide-app/Examples/Confetti.elm b/styleguide-app/Examples/Confetti.elm index e3325631..ad4a1f0a 100644 --- a/styleguide-app/Examples/Confetti.elm +++ b/styleguide-app/Examples/Confetti.elm @@ -8,12 +8,7 @@ module Examples.Confetti exposing (example, State, Msg) import Browser.Events import Category exposing (Category(..)) -import Css exposing (Color) -import Dict exposing (Dict) import Example exposing (Example) -import Html.Styled as Html exposing (Html) -import Html.Styled.Attributes as Attributes exposing (css) -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.Button.V10 as Button import Nri.Ui.Confetti.V2 as Confetti diff --git a/styleguide-app/Examples/Container.elm b/styleguide-app/Examples/Container.elm index 2c3134da..533a1679 100644 --- a/styleguide-app/Examples/Container.elm +++ b/styleguide-app/Examples/Container.elm @@ -14,14 +14,10 @@ import Debug.Control.Extra as ControlExtra import Example exposing (Example) import Html.Styled as Html exposing (Html) import Html.Styled.Attributes exposing (css) -import Html.Styled.Events exposing (onClick) -import KeyboardSupport exposing (Direction(..), Key(..)) -import Nri.Ui.Button.V10 as Button import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Container.V2 as Container import Nri.Ui.Heading.V2 as Heading import Nri.Ui.Svg.V1 as Svg -import Nri.Ui.Text.V6 as Text import Nri.Ui.UiIcon.V1 as UiIcon diff --git a/styleguide-app/Examples/DisclosureIndicator.elm b/styleguide-app/Examples/DisclosureIndicator.elm index 46f576b8..9f8273a3 100644 --- a/styleguide-app/Examples/DisclosureIndicator.elm +++ b/styleguide-app/Examples/DisclosureIndicator.elm @@ -11,10 +11,7 @@ import Css import Example exposing (Example) import Html.Styled as Html import Html.Styled.Attributes exposing (css) -import Html.Styled.Events exposing (onClick) -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.Button.V10 as Button -import Nri.Ui.Colors.V1 as Colors import Nri.Ui.DisclosureIndicator.V2 as DisclosureIndicator import Nri.Ui.Text.V6 as Text diff --git a/styleguide-app/Examples/Divider.elm b/styleguide-app/Examples/Divider.elm index d81abccc..0cdc2358 100644 --- a/styleguide-app/Examples/Divider.elm +++ b/styleguide-app/Examples/Divider.elm @@ -7,11 +7,7 @@ module Examples.Divider exposing (Msg, State, example) -} import Category exposing (Category(..)) -import Css import Example exposing (Example) -import Html.Styled as Html -import Html.Styled.Attributes exposing (css) -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.Divider.V2 as Divider diff --git a/styleguide-app/Examples/Fonts.elm b/styleguide-app/Examples/Fonts.elm index 9f9da583..6e5adfc5 100644 --- a/styleguide-app/Examples/Fonts.elm +++ b/styleguide-app/Examples/Fonts.elm @@ -11,7 +11,6 @@ import Css exposing (Style) import Example exposing (Example) import Html.Styled as Html exposing (Html) import Html.Styled.Attributes exposing (css) -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.Fonts.V1 as Fonts import Nri.Ui.Heading.V2 as Heading diff --git a/styleguide-app/Examples/Heading.elm b/styleguide-app/Examples/Heading.elm index 8aecec39..5f88add8 100644 --- a/styleguide-app/Examples/Heading.elm +++ b/styleguide-app/Examples/Heading.elm @@ -10,7 +10,6 @@ import Category exposing (Category(..)) import Css import Example exposing (Example) import Html.Styled as Html -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Heading.V2 as Heading import ViewHelpers exposing (viewExamples) diff --git a/styleguide-app/Examples/IconExamples.elm b/styleguide-app/Examples/IconExamples.elm index 24240703..8a542242 100644 --- a/styleguide-app/Examples/IconExamples.elm +++ b/styleguide-app/Examples/IconExamples.elm @@ -2,7 +2,7 @@ module Examples.IconExamples exposing (preview, view, viewWithCustomStyles) import Css import Html.Styled as Html exposing (Html) -import Html.Styled.Attributes exposing (css, style, title) +import Html.Styled.Attributes exposing (css) import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Heading.V2 as Heading import Nri.Ui.Svg.V1 as Svg diff --git a/styleguide-app/Examples/Loading.elm b/styleguide-app/Examples/Loading.elm index 46b9a0b3..f666d471 100644 --- a/styleguide-app/Examples/Loading.elm +++ b/styleguide-app/Examples/Loading.elm @@ -9,15 +9,12 @@ module Examples.Loading exposing (example, State, Msg) import Browser.Events import Category exposing (Category(..)) import Css -import Css.Global exposing (Snippet, adjacentSiblings, children, class, descendants, each, everything, media, selector, withClass) import Example exposing (Example) import Html.Styled as Html exposing (Html) import Html.Styled.Events as Events import Json.Decode -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.Button.V10 as Button import Nri.Ui.Colors.V1 as Colors -import Nri.Ui.Heading.V2 as Heading import Nri.Ui.Loading.V1 as Loading import Nri.Ui.Svg.V1 as Svg import Nri.Ui.Text.V6 as Text diff --git a/styleguide-app/Examples/Logo.elm b/styleguide-app/Examples/Logo.elm index f6682581..161b03ef 100644 --- a/styleguide-app/Examples/Logo.elm +++ b/styleguide-app/Examples/Logo.elm @@ -10,9 +10,8 @@ import Category exposing (Category(..)) import Css import Example exposing (Example) import Examples.IconExamples as IconExamples -import Html.Styled as Html exposing (Html) +import Html.Styled as Html import Html.Styled.Attributes exposing (css) -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Logo.V1 as Logo import Nri.Ui.Svg.V1 as Svg diff --git a/styleguide-app/Examples/Menu.elm b/styleguide-app/Examples/Menu.elm index 5d52da02..85cedfec 100644 --- a/styleguide-app/Examples/Menu.elm +++ b/styleguide-app/Examples/Menu.elm @@ -13,12 +13,11 @@ import Css import Debug.Control as Control exposing (Control) import Example exposing (Example) import Html.Styled.Attributes exposing (css) -import KeyboardSupport exposing (Direction(..), Key(..)) +import KeyboardSupport exposing (Key(..)) import Nri.Ui.ClickableSvg.V2 as ClickableSvg import Nri.Ui.ClickableText.V3 as ClickableText -import Nri.Ui.Heading.V2 as Heading import Nri.Ui.Menu.V3 as Menu -import Nri.Ui.Svg.V1 as Svg exposing (Svg) +import Nri.Ui.Svg.V1 exposing (Svg) import Nri.Ui.Tooltip.V2 as Tooltip import Nri.Ui.UiIcon.V1 as UiIcon import Set exposing (Set) @@ -299,7 +298,6 @@ type Msg | SetIconButtonWithMenuConfiguration (Control IconButtonWithMenuConfiguration) | FocusAndToggle String { isOpen : Bool, focus : Maybe String } | Focused (Result Dom.Error ()) - | NoOp {-| -} @@ -319,11 +317,7 @@ update msg state = ) ConsoleLog message -> - let - _ = - Debug.log "Menu Example" message - in - ( state, Cmd.none ) + ( Debug.log "Menu Example" message |> always state, Cmd.none ) SetViewConfiguration configuration -> ( { state | viewConfiguration = configuration }, Cmd.none ) @@ -347,9 +341,6 @@ update msg state = Focused _ -> ( state, Cmd.none ) - NoOp -> - ( state, Cmd.none ) - -- INTERNAL @@ -357,7 +348,3 @@ update msg state = type alias Id = String - - -type alias Value = - String diff --git a/styleguide-app/Examples/Message.elm b/styleguide-app/Examples/Message.elm index f1559ac1..7d4799fd 100644 --- a/styleguide-app/Examples/Message.elm +++ b/styleguide-app/Examples/Message.elm @@ -1,15 +1,13 @@ module Examples.Message exposing (Msg, State, example) -import Accessibility.Styled as Html exposing (..) +import Accessibility.Styled exposing (..) import Category exposing (Category(..)) import CommonControls -import Css exposing (..) +import Css import Debug.Control as Control exposing (Control) import Debug.Control.Extra as ControlExtra import Debug.Control.View as ControlView import Example exposing (Example) -import Html.Styled.Attributes as Attributes exposing (css, href) -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Heading.V2 as Heading import Nri.Ui.Message.V3 as Message diff --git a/styleguide-app/Examples/Modal.elm b/styleguide-app/Examples/Modal.elm index 1fa5f2be..9141c4b7 100644 --- a/styleguide-app/Examples/Modal.elm +++ b/styleguide-app/Examples/Modal.elm @@ -6,7 +6,7 @@ module Examples.Modal exposing (Msg, State, example) -} -import Accessibility.Styled as Html exposing (Html, div, h3, h4, p, span, text) +import Accessibility.Styled as Html exposing (Html, div, text) import Accessibility.Styled.Key as Key import Browser.Dom as Dom import Category exposing (Category(..)) @@ -15,14 +15,12 @@ import Debug.Control as Control exposing (Control) import Debug.Control.Extra as ControlExtra import Example exposing (Example) import Html.Styled.Attributes as Attributes exposing (css) -import KeyboardSupport exposing (Direction(..), Key(..)) +import KeyboardSupport import Nri.Ui.Button.V10 as Button -import Nri.Ui.Checkbox.V5 as Checkbox import Nri.Ui.ClickableSvg.V2 as ClickableSvg import Nri.Ui.ClickableText.V3 as ClickableText import Nri.Ui.Colors.Extra import Nri.Ui.Colors.V1 as Colors -import Nri.Ui.FocusTrap.V1 as FocusTrap import Nri.Ui.Fonts.V1 as Fonts import Nri.Ui.Modal.V11 as Modal import Nri.Ui.Text.V6 as Text diff --git a/styleguide-app/Examples/Page.elm b/styleguide-app/Examples/Page.elm index cab7e94c..578b8865 100644 --- a/styleguide-app/Examples/Page.elm +++ b/styleguide-app/Examples/Page.elm @@ -9,13 +9,11 @@ module Examples.Page exposing (example, State, Msg) import Category exposing (Category(..)) import CommonControls import Css -import Css.Global exposing (Snippet, adjacentSiblings, children, class, descendants, each, everything, media, selector, withClass) import Debug.Control as Control exposing (Control) import Example exposing (Example) import Html.Styled as Html exposing (Html) import Html.Styled.Attributes exposing (css) import Http -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Fonts.V1 as Fonts import Nri.Ui.Heading.V2 as Heading @@ -40,11 +38,7 @@ update : Msg -> State -> ( State, Cmd Msg ) update msg model = case msg of ShowItWorked message -> - let - _ = - Debug.log "Clicked: " message - in - ( model, Cmd.none ) + ( Debug.log "Clicked: " message |> always model, Cmd.none ) SetHttpError controls -> ( { model | httpError = controls }, Cmd.none ) diff --git a/styleguide-app/Examples/Pennant.elm b/styleguide-app/Examples/Pennant.elm index 8cadebb2..403e3889 100644 --- a/styleguide-app/Examples/Pennant.elm +++ b/styleguide-app/Examples/Pennant.elm @@ -7,15 +7,10 @@ module Examples.Pennant exposing (example, State, Msg) -} import Category exposing (Category(..)) -import Css exposing (..) +import Css import Example exposing (Example) import Examples.IconExamples as IconExamples -import Html.Styled as Html exposing (Html) -import Html.Styled.Attributes exposing (css) -import KeyboardSupport exposing (Direction(..), Key(..)) -import Nri.Ui.Fonts.V1 as Fonts import Nri.Ui.Pennant.V2 as Pennant -import Nri.Ui.Svg.V1 as Svg {-| -} diff --git a/styleguide-app/Examples/RadioButton.elm b/styleguide-app/Examples/RadioButton.elm index dbd8c457..5461247e 100644 --- a/styleguide-app/Examples/RadioButton.elm +++ b/styleguide-app/Examples/RadioButton.elm @@ -19,12 +19,11 @@ import Debug.Control as Control exposing (Control) import Debug.Control.Extra as ControlExtra import Example exposing (Example) import Html.Styled as Html exposing (..) -import Html.Styled.Attributes as Attributes exposing (css) +import Html.Styled.Attributes exposing (css) import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.Button.V10 as Button import Nri.Ui.Colors.V1 as Colors -import Nri.Ui.Data.PremiumDisplay as PremiumDisplay exposing (PremiumDisplay) -import Nri.Ui.Heading.V2 as Heading +import Nri.Ui.Data.PremiumDisplay as PremiumDisplay import Nri.Ui.Modal.V11 as Modal import Nri.Ui.RadioButton.V4 as RadioButton import Nri.Ui.Text.V6 as Text diff --git a/styleguide-app/Examples/SegmentedControl.elm b/styleguide-app/Examples/SegmentedControl.elm index 5f92b7d1..f1a186bf 100644 --- a/styleguide-app/Examples/SegmentedControl.elm +++ b/styleguide-app/Examples/SegmentedControl.elm @@ -16,9 +16,8 @@ import Category exposing (Category(..)) import Css import Debug.Control as Control exposing (Control) import Example exposing (Example) -import Html.Styled.Attributes as Attributes exposing (css) -import Html.Styled.Events as Events -import KeyboardSupport exposing (Direction(..), Key(..)) +import Html.Styled.Attributes exposing (css) +import KeyboardSupport exposing (Key(..)) import Nri.Ui.Colors.V1 as Colors import Nri.Ui.SegmentedControl.V14 as SegmentedControl import Nri.Ui.Svg.V1 as Svg exposing (Svg) diff --git a/styleguide-app/Examples/Select.elm b/styleguide-app/Examples/Select.elm index f424155d..c09b525d 100644 --- a/styleguide-app/Examples/Select.elm +++ b/styleguide-app/Examples/Select.elm @@ -14,9 +14,7 @@ import Debug.Control.Extra as ControlExtra import Example exposing (Example) import Html.Styled import Html.Styled.Attributes exposing (css) -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.Colors.V1 as Colors -import Nri.Ui.Heading.V2 as Heading import Nri.Ui.Select.V8 as Select exposing (Choice) @@ -214,11 +212,7 @@ update : Msg -> State -> ( State, Cmd Msg ) update msg state = case msg of ConsoleLog message -> - let - _ = - Debug.log "SelectExample" message - in - ( state, Cmd.none ) + ( Debug.log "SelectExample" message |> always state, Cmd.none ) UpdateLabel label -> ( { state | label = label } diff --git a/styleguide-app/Examples/Shadows.elm b/styleguide-app/Examples/Shadows.elm index db690e75..9bcc71f8 100644 --- a/styleguide-app/Examples/Shadows.elm +++ b/styleguide-app/Examples/Shadows.elm @@ -10,7 +10,7 @@ import Category exposing (Category(..)) import Css exposing (Style) import Example exposing (Example) import Html.Styled as Html exposing (Html) -import Html.Styled.Attributes as Attributes exposing (css) +import Html.Styled.Attributes as Attributes import Nri.Ui.Shadows.V1 as Shadows import Nri.Ui.Text.V6 as Text import ViewHelpers diff --git a/styleguide-app/Examples/SideNav.elm b/styleguide-app/Examples/SideNav.elm index 8264cfc8..53d68113 100644 --- a/styleguide-app/Examples/SideNav.elm +++ b/styleguide-app/Examples/SideNav.elm @@ -14,11 +14,8 @@ import Debug.Control as Control exposing (Control) import Debug.Control.Extra as ControlExtra import Debug.Control.View as ControlView import Example exposing (Example) -import Html.Styled import Html.Styled.Attributes exposing (css) -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.Colors.V1 as Colors -import Nri.Ui.Heading.V2 as Heading import Nri.Ui.SideNav.V2 as SideNav @@ -253,8 +250,4 @@ update msg state = ( state, Cmd.none ) ConsoleLog message -> - let - _ = - Debug.log "SideNav" message - in - ( state, Cmd.none ) + ( Debug.log "SideNav" message |> always state, Cmd.none ) diff --git a/styleguide-app/Examples/SlideModal.elm b/styleguide-app/Examples/SlideModal.elm index 6164c0f0..668c6c73 100644 --- a/styleguide-app/Examples/SlideModal.elm +++ b/styleguide-app/Examples/SlideModal.elm @@ -6,13 +6,12 @@ module Examples.SlideModal exposing (Msg, State, example) -} -import Accessibility.Styled as Html exposing (Html, div, h3, p, text) +import Accessibility.Styled as Html exposing (Html, div) import Category exposing (Category(..)) import Css import Example exposing (Example) import Html.Styled exposing (fromUnstyled) import Html.Styled.Attributes exposing (css) -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.Button.V10 as Button import Nri.Ui.Colors.V1 as Colors import Nri.Ui.SlideModal.V2 as SlideModal diff --git a/styleguide-app/Examples/SortableTable.elm b/styleguide-app/Examples/SortableTable.elm index d62638e9..0e2f49a0 100644 --- a/styleguide-app/Examples/SortableTable.elm +++ b/styleguide-app/Examples/SortableTable.elm @@ -9,7 +9,6 @@ module Examples.SortableTable exposing (Msg, State, example) import Category exposing (Category(..)) import Example exposing (Example) import Html.Styled as Html -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.Heading.V2 as Heading import Nri.Ui.SortableTable.V2 as SortableTable @@ -22,8 +21,7 @@ type Column {-| -} type Msg - = NoOp - | SetSortState (SortableTable.State Column) + = SetSortState (SortableTable.State Column) {-| -} @@ -99,8 +97,5 @@ init = update : Msg -> State -> ( State, Cmd Msg ) update msg state = case msg of - NoOp -> - ( state, Cmd.none ) - SetSortState sortState -> ( { state | sortState = sortState }, Cmd.none ) diff --git a/styleguide-app/Examples/Sprite.elm b/styleguide-app/Examples/Sprite.elm index a8753c82..162500b5 100644 --- a/styleguide-app/Examples/Sprite.elm +++ b/styleguide-app/Examples/Sprite.elm @@ -6,11 +6,9 @@ module Examples.Sprite exposing (example, State, Msg) -} -import Accessibility.Styled.Aria as Aria import Category exposing (Category(..)) import Example exposing (Example) import Examples.IconExamples as IconExamples -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.Sprite.V1 as Sprite exposing (SpriteId) import Nri.Ui.Svg.V1 as Svg exposing (Svg) import Svg.Styled exposing (svg) diff --git a/styleguide-app/Examples/Svg.elm b/styleguide-app/Examples/Svg.elm index a11e07fa..fde2e09a 100644 --- a/styleguide-app/Examples/Svg.elm +++ b/styleguide-app/Examples/Svg.elm @@ -9,14 +9,11 @@ module Examples.Svg exposing (Msg, State, example) import Category exposing (Category(..)) import Css import Example exposing (Example) -import Examples.IconExamples as IconExamples import Html.Styled as Html import Html.Styled.Attributes as Attributes import Html.Styled.Events as Events -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.Colors.Extra exposing (fromCssColor, toCssColor) import Nri.Ui.Colors.V1 as Colors -import Nri.Ui.Heading.V2 as Heading import Nri.Ui.Svg.V1 as Svg import Nri.Ui.UiIcon.V1 as UiIcon import SolidColor exposing (SolidColor) diff --git a/styleguide-app/Examples/Table.elm b/styleguide-app/Examples/Table.elm index c9e4e0bb..71fd0ce7 100644 --- a/styleguide-app/Examples/Table.elm +++ b/styleguide-app/Examples/Table.elm @@ -10,7 +10,6 @@ import Category exposing (Category(..)) import Css exposing (..) import Example exposing (Example) import Html.Styled as Html -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.Button.V10 as Button import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Heading.V2 as Heading diff --git a/styleguide-app/Examples/Tabs.elm b/styleguide-app/Examples/Tabs.elm index 9e7a9b2a..25c5550f 100644 --- a/styleguide-app/Examples/Tabs.elm +++ b/styleguide-app/Examples/Tabs.elm @@ -15,10 +15,9 @@ import Category exposing (Category(..)) import Css import Debug.Control as Control exposing (Control) import Example exposing (Example) -import Html.Styled as Html exposing (Html, fromUnstyled) +import Html.Styled as Html exposing (fromUnstyled) import Html.Styled.Attributes exposing (css) import KeyboardSupport exposing (Key(..)) -import List.Zipper exposing (Zipper) import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Svg.V1 as Svg import Nri.Ui.Tabs.V7 as Tabs exposing (Alignment(..), Tab) diff --git a/styleguide-app/Examples/Text.elm b/styleguide-app/Examples/Text.elm index 4dda7c84..0adedf0f 100644 --- a/styleguide-app/Examples/Text.elm +++ b/styleguide-app/Examples/Text.elm @@ -7,14 +7,13 @@ module Examples.Text exposing (example, State, Msg) -} import Category exposing (Category(..)) -import CommonControls exposing (exampleHtml, quickBrownFox, romeoAndJulietQuotation) +import CommonControls import Css import Debug.Control as Control exposing (Control) import Debug.Control.Extra as ControlExtra import Example exposing (Example) import Html.Styled as Html exposing (Html) -import Html.Styled.Attributes as Attributes exposing (css) -import KeyboardSupport exposing (Direction(..), Key(..)) +import Html.Styled.Attributes exposing (css) import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Heading.V2 as Heading import Nri.Ui.Text.V6 as Text diff --git a/styleguide-app/Examples/Text/Writing.elm b/styleguide-app/Examples/Text/Writing.elm index 22299a47..bf6cf4e7 100644 --- a/styleguide-app/Examples/Text/Writing.elm +++ b/styleguide-app/Examples/Text/Writing.elm @@ -9,7 +9,6 @@ module Examples.Text.Writing exposing (example, State, Msg) import Category exposing (Category(..)) import Example exposing (Example) import Html.Styled exposing (text) -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.Text.Writing.V1 as TextWriting diff --git a/styleguide-app/Examples/TextArea.elm b/styleguide-app/Examples/TextArea.elm index f39bf075..aa8ae39d 100644 --- a/styleguide-app/Examples/TextArea.elm +++ b/styleguide-app/Examples/TextArea.elm @@ -10,8 +10,6 @@ import Category exposing (Category(..)) import Dict exposing (Dict) import Example exposing (Example) import Html.Styled as Html -import KeyboardSupport exposing (Direction(..), Key(..)) -import Nri.Ui.AssetPath exposing (Asset(..)) import Nri.Ui.Checkbox.V5 as Checkbox import Nri.Ui.Heading.V2 as Heading import Nri.Ui.TextArea.V4 as TextArea diff --git a/styleguide-app/Examples/TextInput.elm b/styleguide-app/Examples/TextInput.elm index e3dd8afe..bc2f933a 100644 --- a/styleguide-app/Examples/TextInput.elm +++ b/styleguide-app/Examples/TextInput.elm @@ -9,16 +9,12 @@ module Examples.TextInput exposing (Msg, State, example) import Accessibility.Styled as Html exposing (..) import Accessibility.Styled.Key as Key import Category exposing (Category(..)) -import Css exposing (..) +import Css import Debug.Control as Control exposing (Control) import Debug.Control.Extra as ControlExtra import Dict exposing (Dict) import Example exposing (Example) -import Html.Styled.Attributes exposing (css) -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.Colors.V1 as Colors -import Nri.Ui.Heading.V2 as Heading -import Nri.Ui.Message.V3 as Message import Nri.Ui.TextInput.V7 as TextInput import ViewHelpers exposing (viewExamples) diff --git a/styleguide-app/Examples/Tooltip.elm b/styleguide-app/Examples/Tooltip.elm index c502e108..ff6739be 100644 --- a/styleguide-app/Examples/Tooltip.elm +++ b/styleguide-app/Examples/Tooltip.elm @@ -14,10 +14,8 @@ import Debug.Control as Control exposing (Control) import Debug.Control.Extra as ControlExtra import Example exposing (Example) import Html.Styled.Attributes as Attributes exposing (css, href) -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.ClickableSvg.V2 as ClickableSvg import Nri.Ui.ClickableText.V3 as ClickableText -import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Heading.V2 as Heading import Nri.Ui.Svg.V1 as Svg import Nri.Ui.Text.V6 as Text diff --git a/styleguide-app/Examples/UiIcon.elm b/styleguide-app/Examples/UiIcon.elm index f97f390a..52bec392 100644 --- a/styleguide-app/Examples/UiIcon.elm +++ b/styleguide-app/Examples/UiIcon.elm @@ -9,7 +9,6 @@ module Examples.UiIcon exposing (example, State, Msg) import Category exposing (Category(..)) import Example exposing (Example) import Examples.IconExamples as IconExamples -import KeyboardSupport exposing (Direction(..), Key(..)) import Nri.Ui.UiIcon.V1 as UiIcon diff --git a/styleguide-app/KeyboardSupport.elm b/styleguide-app/KeyboardSupport.elm index f7395914..a6ac7b93 100644 --- a/styleguide-app/KeyboardSupport.elm +++ b/styleguide-app/KeyboardSupport.elm @@ -13,7 +13,7 @@ module KeyboardSupport exposing -} import Css exposing (..) -import Html.Styled as Html exposing (..) +import Html.Styled exposing (..) import Html.Styled.Attributes exposing (css) diff --git a/styleguide-app/Main.elm b/styleguide-app/Main.elm index f2789143..986d77be 100644 --- a/styleguide-app/Main.elm +++ b/styleguide-app/Main.elm @@ -1,31 +1,24 @@ -module Main exposing (init, main) +module Main exposing (main) import Accessibility.Styled as Html exposing (Html) import Browser exposing (Document, UrlRequest(..)) import Browser.Dom import Browser.Navigation exposing (Key) -import Category exposing (Category) +import Category import Css exposing (..) import Css.Media exposing (withMedia) import Dict exposing (Dict) import Example exposing (Example) import Examples -import Html.Attributes -import Html.Styled.Attributes as Attributes exposing (..) -import Html.Styled.Events as Events -import Nri.Ui.ClickableText.V3 as ClickableText -import Nri.Ui.Colors.V1 as Colors +import Html.Styled.Attributes exposing (..) import Nri.Ui.CssVendorPrefix.V1 as VendorPrefixed -import Nri.Ui.Data.PremiumLevel as PremiumLevel -import Nri.Ui.Fonts.V1 as Fonts import Nri.Ui.Heading.V2 as Heading import Nri.Ui.MediaQuery.V1 exposing (mobile, notMobile) import Nri.Ui.Page.V3 as Page import Nri.Ui.SideNav.V2 as SideNav import Nri.Ui.Sprite.V1 as Sprite -import Nri.Ui.UiIcon.V1 as UiIcon -import Routes as Routes exposing (Route(..)) -import Sort.Set as Set exposing (Set) +import Routes exposing (Route) +import Sort.Set as Set import Task import Url exposing (Url) diff --git a/styleguide-app/Routes.elm b/styleguide-app/Routes.elm index 6fc49ee4..0e18dbc2 100644 --- a/styleguide-app/Routes.elm +++ b/styleguide-app/Routes.elm @@ -1,6 +1,5 @@ module Routes exposing (Route(..), fromLocation, toString) -import Browser.Navigation as Navigation import Category import Parser exposing ((|.), (|=), Parser) import Url exposing (Url) diff --git a/styleguide-app/ViewHelpers.elm b/styleguide-app/ViewHelpers.elm index 0fc3d4a3..7ba49093 100644 --- a/styleguide-app/ViewHelpers.elm +++ b/styleguide-app/ViewHelpers.elm @@ -2,7 +2,7 @@ module ViewHelpers exposing (viewExamples) import Css import Html.Styled as Html exposing (Html) -import Html.Styled.Attributes as Attributes exposing (css) +import Html.Styled.Attributes exposing (css) viewExamples : List ( String, Html msg ) -> Html msg From 111cf2138303c19c5aed76085349f9cad7332233 Mon Sep 17 00:00:00 2001 From: Ju Liu <ju@noredink.com> Date: Tue, 15 Mar 2022 18:15:33 +0000 Subject: [PATCH 7/7] Add shake rule for running elm-review in the styleguide app --- Shakefile.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Shakefile.hs b/Shakefile.hs index af9e832d..35f620f8 100644 --- a/Shakefile.hs +++ b/Shakefile.hs @@ -49,6 +49,7 @@ main = do "log/elm-verify-examples.txt", "log/elm-test.txt", "log/elm-review.txt", + "log/elm-review-styleguide.txt", "log/axe-report.txt", "log/percy-tests.txt", "log/forbidden-imports-report.txt", @@ -85,10 +86,15 @@ main = do cmd (WithStdout True) (FileStdout out) "elm-test" "log/elm-review.txt" %> \out -> do - elmFiles <- getDirectoryFiles "." ["**/*.elm"] + elmFiles <- getDirectoryFiles "." ["src/**/*.elm", "tests/**/*.elm"] need (["package.json", "elm.json"] ++ elmFiles) cmd (WithStdout True) (FileStdout out) "elm-review" + "log/elm-review-styleguide.txt" %> \out -> do + elmFiles <- getDirectoryFiles "." ["styleguide-app/**/*.elm"] + need (["package.json", "elm.json", "styleguide-app/elm.json"] ++ elmFiles) + cmd (Cwd "styleguide-app") (WithStdout True) (FileStdout out) "elm-review" + "log/elm-verify-examples.txt" %> \out -> do elmFiles <- getDirectoryFiles "." ["src/**/*.elm"] need (["tests/elm-verify-examples.json"] ++ elmFiles)