@gitlab/eslint-plugin 9.4.0 → 11.0.0

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,44 @@
1
+ # [11.0.0](https://gitlab.com/gitlab-org/frontend/eslint-plugin/compare/v10.0.2...v11.0.0) (2022-02-22)
2
+
3
+
4
+ ### Features
5
+
6
+ * remove unused rule vue-emit-events-with-two-args ([f9a4ddc](https://gitlab.com/gitlab-org/frontend/eslint-plugin/commit/f9a4ddc967f163bd6aa9503b5c0cf86be28617dc))
7
+
8
+
9
+ ### BREAKING CHANGES
10
+
11
+ * rule 'vue-emit-events-with-two-args' was removed.
12
+
13
+ ## [10.0.2](https://gitlab.com/gitlab-org/frontend/eslint-plugin/compare/v10.0.1...v10.0.2) (2022-01-12)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * rule require-i18n-strings reports mailto false positive ([5b3397e](https://gitlab.com/gitlab-org/frontend/eslint-plugin/commit/5b3397e929e6693be507e84742e1b35563ff87aa))
19
+
20
+ ## [10.0.1](https://gitlab.com/gitlab-org/frontend/eslint-plugin/compare/v10.0.0...v10.0.1) (2022-01-10)
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * **ci:** Generate GraphQL schema before running integration test ([d5e6d88](https://gitlab.com/gitlab-org/frontend/eslint-plugin/commit/d5e6d88e5bb2e06d1ea923a95f7b1a425e5b09d0))
26
+
27
+ # [10.0.0](https://gitlab.com/gitlab-org/frontend/eslint-plugin/compare/v9.4.0...v10.0.0) (2021-11-03)
28
+
29
+
30
+ ### Features
31
+
32
+ * lint against missing translation namespaces ([db00d87](https://gitlab.com/gitlab-org/frontend/eslint-plugin/commit/db00d87e3877fa0fe538775280a54fd820c89572))
33
+
34
+
35
+ ### BREAKING CHANGES
36
+
37
+ * require-string-literal-i18n-helpers and
38
+ vue-require-string-literal-i18n-helpers rules have been renamed to
39
+ require-valid-i18n-helpers and vue-require-valid-i18n-helpers
40
+ respectively.
41
+
1
42
  # [9.4.0](https://gitlab.com/gitlab-org/frontend/eslint-plugin/compare/v9.3.0...v9.4.0) (2021-09-21)
2
43
 
3
44
 
@@ -0,0 +1,40 @@
1
+ ## Developer Certificate of Origin and License
2
+
3
+ By contributing to GitLab B.V., you accept and agree to the following terms and
4
+ conditions for your present and future contributions submitted to GitLab B.V.
5
+ Except for the license granted herein to GitLab B.V. and recipients of software
6
+ distributed by GitLab B.V., you reserve all right, title, and interest in and to
7
+ your Contributions.
8
+
9
+ All contributions are subject to the Developer Certificate of Origin and license set out at [docs.gitlab.com/ce/legal/developer_certificate_of_origin](https://docs.gitlab.com/ce/legal/developer_certificate_of_origin).
10
+
11
+ _This notice should stay as the first item in the CONTRIBUTING.md file._
12
+
13
+ ## Code of conduct
14
+
15
+ As contributors and maintainers of this project, we pledge to respect all people
16
+ who contribute through reporting issues, posting feature requests, updating
17
+ documentation, submitting pull requests or patches, and other activities.
18
+
19
+ We are committed to making participation in this project a harassment-free
20
+ experience for everyone, regardless of level of experience, gender, gender
21
+ identity and expression, sexual orientation, disability, personal appearance,
22
+ body size, race, ethnicity, age, or religion.
23
+
24
+ Examples of unacceptable behavior by participants include the use of sexual
25
+ language or imagery, derogatory comments or personal attacks, trolling, public
26
+ or private harassment, insults, or other unprofessional conduct.
27
+
28
+ Project maintainers have the right and responsibility to remove, edit, or reject
29
+ comments, commits, code, wiki edits, issues, and other contributions that are
30
+ not aligned to this Code of Conduct. Project maintainers who do not follow the
31
+ Code of Conduct may be removed from the project team.
32
+
33
+ This code of conduct applies both within project spaces and in public spaces
34
+ when an individual is representing the project or its community.
35
+
36
+ Instances of abusive, harassing, or otherwise unacceptable behavior can be
37
+ reported by emailing contact@gitlab.com.
38
+
39
+ This Code of Conduct is adapted from the [Contributor Covenant](https://contributor-covenant.org), version 1.1.0,
40
+ available at [https://contributor-covenant.org/version/1/1/0/](https://contributor-covenant.org/version/1/1/0/).
@@ -18,3 +18,18 @@ Run `yarn createRule`, it will create:
18
18
  - `docs/rules/<name>.js` (documentation)
19
19
  - `lib/rules/<name>.js` (rule definition)
20
20
  - `tests/rules/<name>.js` (rule unit tests)
21
+
22
+ ## Testing
23
+
24
+ Run `yarn test` to execute the test suite, the suite includes rule tests and util tests.
25
+ Jest is used as the test runner for executing these tests.
26
+
27
+ ### Rule tests
28
+
29
+ The [eslint ruletester](https://eslint.org/docs/developer-guide/unit-tests) is used to write tests for eslint rules, new tests should be added for new rules or updates to a rule.
30
+
31
+ All the current rule tests are available in the `tests/lib/rules` directory.
32
+
33
+ ### Util tests
34
+
35
+ These utilities are useful to simplify writing new tests and can be found in the `test/lib/utils` directory.
@@ -0,0 +1,41 @@
1
+ # @gitlab/require-valid-i18n-helpers
2
+
3
+ This rule enforces valid usages of the translation helpers (`__`, `s__` and `n__`). It requires the
4
+ following:
5
+
6
+ - All helpers should be called with string-literal arguments to ensure the strings are properly
7
+ collected by the `gettext:regenerate` script.
8
+ - `s__` requires a translation namespace to be provided.
9
+
10
+ ## Rule Details
11
+
12
+ ### Examples of **incorrect** code for this rule
13
+
14
+ ```js
15
+ // Invalid argument types
16
+ const label = __(LABEL);
17
+ const description = __(getDescription());
18
+
19
+ // Missing translation namespace
20
+ const namespacedTranslation = s__('NamespacedTranslation');
21
+ ```
22
+
23
+ ### Examples of **correct** code for this rule
24
+
25
+ ```js
26
+ // Valid argument type
27
+ const label = __('Some label');
28
+
29
+ // Valid translation namespace
30
+ const namespacedTranslation = s__('Namespace|Translation');
31
+ // or
32
+ const otherNamespacedTranslation = s__('Namespace', 'Other translation');
33
+ ```
34
+
35
+ ## Options
36
+
37
+ Nothing
38
+
39
+ ## Related rules
40
+
41
+ - TBA
@@ -0,0 +1,42 @@
1
+ # @gitlab/vue-require-valid-i18n-helpers
2
+
3
+ This rule is like [require-valid-i18n-helpers](./require-valid-i18n-helpers.md) for Vue templates.
4
+
5
+ ## Rule Details
6
+
7
+ ### Examples of **incorrect** code for this rule
8
+
9
+ ```html
10
+ <template>
11
+ <div>
12
+ <!-- Invalid argument types -->
13
+ {{ __(LABEL) }}
14
+ {{ __(getDescription()) }}
15
+
16
+ <!-- Missing translation namespace -->
17
+ {{ s__('NamespacedTranslation') }}
18
+ </div>
19
+ </template>
20
+ ```
21
+
22
+ ### Examples of **correct** code for this rule
23
+
24
+ ```html
25
+ <template>
26
+ <div>
27
+ <!-- Valid argument type -->
28
+ {{ __('Some label') }}
29
+
30
+ <!-- Valid translation namespace -->
31
+ {{ s__('Namespace|Translation') }}
32
+ </div>
33
+ </template>
34
+ ```
35
+
36
+ ## Options
37
+
38
+ Nothing
39
+
40
+ ## Related rules
41
+
42
+ - TBA
package/docs/rules.md CHANGED
@@ -7,12 +7,11 @@ Available rules:
7
7
  - [no-global-event-off](./rules/no-global-event-off.md): Throw an error when globally deregistering all event listeners.
8
8
  - [no-runtime-template-compiler](./rules/no-runtime-template-compiler.md): Disallow components which rely on a runtime template compiler.
9
9
  - [require-i18n-strings](./rules/require-i18n-strings.md): Detect a string which has been hard coded and requires externalization.
10
- - [require-string-literal-i18n-helpers](./rules/require-string-literal-i18n-helpers.md): Prevents translation helpers from being called with non-string-literal arguments.
11
- - [vue-emit-events-with-two-args](./rules/vue-emit-events-with-two-args.md): Throw an error when emit is called with more than two arguments.
10
+ - [require-valid-i18n-helpers](./rules/require-valid-i18n-helpers.md): Enforces valid usage of translation helpers in JavaScript.
12
11
  - [vue-no-data-toggle](./rules/vue-no-data-toggle.md): Restrict the use of `data-toggle` bootstrap behaviors within Vue templates
13
12
  - [vue-no-new-non-primitive-in-template](./rules/vue-no-new-non-primitive-in-template.md): Prevents non-primitive values from being declared in templates
14
13
  - [vue-require-i18n-attribute-strings](./rules/vue-require-i18n-attribute-strings.md): Detect non externalized strings in vue `<template>` attributes
15
14
  - [vue-require-i18n-strings](./rules/vue-require-i18n-strings.md): enforce no bare strings in vue `<template>`
16
15
  - [vue-require-required-key](./rules/vue-require-required-key.md): Require the required key to be set
17
- - [vue-require-string-literal-i18n-helpers](./rules/vue-require-string-literal-i18n-helpers.md): Prevents translation helpers from being called with non-string-literal arguments in Vue templates.
16
+ - [vue-require-valid-i18n-helpers](./rules/vue-require-valid-i18n-helpers.md): Enforces valid usage of translation helpers in Vue templates.
18
17
  - [vue-slot-name-casing](./rules/vue-slot-name-casing.md): enforce specific casing for slot naming style in template