tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

stylelint.rst (2644B)


      1 Stylelint
      2 =========
      3 
      4 `Stylelint`__ is a popular linter for CSS.
      5 
      6 Run Locally
      7 -----------
      8 
      9 The mozlint integration of Stylelint can be run using mach:
     10 
     11 .. parsed-literal::
     12 
     13    $ mach lint --linter stylelint <file paths>
     14 
     15 Alternatively, omit the ``--linter stylelint`` and run all configured linters, which will include
     16 Stylelint.
     17 
     18 Stylelint also supports the ``--fix`` option to autofix most errors raised from most of the rules.
     19 
     20 See the `Usage guide`_ for more options.
     21 
     22 Understanding Rules and Errors
     23 ------------------------------
     24 
     25 * Only some files are linted, see the :searchfox:`configuration <tools/lint/stylelint.yml>` for details.
     26 
     27  * By design we do not lint/format reftests not crashtests as these are specially crafted tests.
     28 
     29 * If you don't understand a rule, you can look it in `stylelint.io's rule list`_ for more
     30  information about it.
     31 
     32 Enabling new rules and adding plugins
     33 -------------------------------------
     34 
     35 Please see `this page for enabling new rules <stylelint/enabling-rules.html>`_.
     36 
     37 Common Issues and How To Solve Them
     38 -----------------------------------
     39 
     40 This code should neither be linted nor formatted
     41 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     42 
     43 * If it is a third-party piece of code, please add it to :searchfox:`ThirdPartyPaths.txt <tools/rewriting/ThirdPartyPaths.txt>`.
     44 * If it is a generated file, please add it to :searchfox:`Generated.txt <tools/rewriting/Generated.txt>`.
     45 * If intentionally invalid, please add it to :searchfox:`.stylelintignore <.stylelintignore>`.
     46 
     47 Configuration
     48 -------------
     49 
     50 The global configuration file lives in ``topsrcdir/.stylelintrc.js``.
     51 For an overview of the supported configuration, see `Stylelint's documentation`_.
     52 
     53 Please keep differences in rules across the tree to a minimum. We want to be consistent to
     54 make it easier for developers.
     55 
     56 Sources
     57 -------
     58 
     59 * :searchfox:`Configuration (YAML) <tools/lint/stylelint.yml>`
     60 * :searchfox:`Source <tools/lint/stylelint/__init__.py>`
     61 
     62 Builders
     63 --------
     64 
     65 `Gijs Kruitbosch (gijs) <https://people.mozilla.org/s?query=gijs>`__ owns
     66 the builders. Questions can also be asked on #lint:mozilla.org on Matrix.
     67 
     68 Stylelint task
     69 ^^^^^^^^^^^^^^
     70 
     71 This is a tier-1 task. For test failures the patch causing the
     72 issue should be backed out or the issue fixed.
     73 
     74 Some failures can be fixed with ``./mach lint -l stylelint --fix path/to/file``.
     75 
     76 For test harness issues, file bugs in Developer Infrastructure :: Lint and Formatting.
     77 
     78 
     79 .. __: https://stylelint.io/
     80 .. _Usage guide: ../usage.html
     81 .. _Stylelint's documentation: https://stylelint.io/user-guide/configure/
     82 .. _stylelint.io's rule list: https://stylelint.io/user-guide/rules/