Skip to content

Commit f9877a8

Browse files
authored
fix(specs): remove periods on summaries (#3013)
1 parent 509e8a3 commit f9877a8

File tree

137 files changed

+306
-225
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+306
-225
lines changed

.eslintrc.cjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = {
99
'**/target',
1010
'**/.yarn',
1111
'website/specs',
12-
'**/project.packagespec.json'
12+
'**/project.packagespec.json',
1313
],
1414

1515
overrides: [
@@ -52,6 +52,7 @@ module.exports = {
5252
files: ['specs/**/*.yml'],
5353
rules: {
5454
'automation-custom/end-with-dot': 'error',
55+
'automation-custom/no-final-dot': 'error',
5556
'automation-custom/single-quote-ref': 'error',
5657
},
5758
overrides: [
@@ -149,7 +150,7 @@ module.exports = {
149150

150151
parserOptions: {
151152
tsconfigRootDir: __dirname,
152-
project: './clients/algoliasearch-client-javascript/tsconfig.json'
153+
project: './clients/algoliasearch-client-javascript/tsconfig.json',
153154
},
154155

155156
rules: {
@@ -183,6 +184,6 @@ module.exports = {
183184
rules: {
184185
'automation-custom/no-new-line': 'error',
185186
},
186-
}
187+
},
187188
],
188189
};

eslint/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { endWithDot } from './rules/endWithDot';
2+
import { noFinalDot } from './rules/noFinalDot';
23
import { noNewLine } from './rules/noNewLine';
34
import { createOutOfLineRule } from './rules/outOfLineRule';
45
import { singleQuoteRef } from './rules/singleQuoteRef';
56
import { validACL } from './rules/validACL';
67

78
const rules = {
89
'end-with-dot': endWithDot,
10+
'no-final-dot': noFinalDot,
911
'out-of-line-enum': createOutOfLineRule({ property: 'enum' }),
1012
'out-of-line-one-of': createOutOfLineRule({ property: 'oneOf' }),
1113
'out-of-line-all-of': createOutOfLineRule({ property: 'allOf' }),

eslint/src/rules/endWithDot.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import { isBlockScalar, isPairWithKey, isScalar } from '../utils';
55
export const endWithDot: Rule.RuleModule = {
66
meta: {
77
docs: {
8-
description: '`description`, `summary` must end with a dot',
8+
description: '`description` must end with a period',
99
},
1010
messages: {
11-
endWithDot: 'content does not end with a dot',
11+
endWithDot: 'description does not end with a period',
1212
},
1313
fixable: 'code',
1414
},
@@ -20,8 +20,7 @@ export const endWithDot: Rule.RuleModule = {
2020
return {
2121
YAMLPair(node): void {
2222
if (
23-
!isPairWithKey(node, 'description') &&
24-
!isPairWithKey(node, 'summary')
23+
!isPairWithKey(node, 'description')
2524
) {
2625
return;
2726
}

eslint/src/rules/noFinalDot.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import type { Rule } from 'eslint';
2+
3+
import { isPairWithKey, isScalar } from '../utils';
4+
5+
export const noFinalDot: Rule.RuleModule = {
6+
meta: {
7+
docs: {
8+
description: '`summary` must not end with a period',
9+
},
10+
messages: {
11+
noFinalDot: 'summary ends with a period',
12+
},
13+
fixable: 'code',
14+
},
15+
create(context) {
16+
if (!context.sourceCode.parserServices.isYAML) {
17+
return {};
18+
}
19+
20+
return {
21+
YAMLPair(node): void {
22+
if (!isPairWithKey(node, 'summary')) {
23+
return;
24+
}
25+
26+
if (!isScalar(node.value)) {
27+
return;
28+
}
29+
30+
const value = node.value;
31+
if (
32+
typeof value.value !== 'string' ||
33+
!value.value.trim().endsWith('.')
34+
) {
35+
// The rule is respected if:
36+
// the summary is not a string
37+
// or it doesn't end with a dot.
38+
return;
39+
}
40+
41+
context.report({
42+
node: node as any,
43+
messageId: 'noFinalDot',
44+
fix(fixer) {
45+
const end = node.range[1];
46+
return fixer.removeRange([end - 1, end]);
47+
},
48+
});
49+
},
50+
};
51+
},
52+
};

eslint/tests/noFinalDot.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { RuleTester } from 'eslint';
2+
3+
import { noFinalDot } from '../src/rules/noFinalDot';
4+
5+
const ruleTester = new RuleTester({
6+
parser: require.resolve('yaml-eslint-parser'),
7+
});
8+
9+
ruleTester.run('no-final-dot', noFinalDot, {
10+
valid: [`summary: Valid summary`],
11+
invalid: [
12+
{
13+
code: `summary: Has final dot.`,
14+
errors: [{ messageId: 'noFinalDot' }],
15+
output: `summary: Has final dot`,
16+
},
17+
{
18+
code: `summary: With dot and newline.
19+
20+
`,
21+
errors: [{ messageId: 'noFinalDot' }],
22+
output: `summary: With dot and newline
23+
24+
`,
25+
},
26+
],
27+
});

specs/abtesting/paths/abtest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get:
44
operationId: getABTest
55
x-acl:
66
- analytics
7-
summary: Retrieve A/B test details.
7+
summary: Retrieve A/B test details
88
description: Retrieves the details for an A/B test by its ID.
99
parameters:
1010
- $ref: '../common/parameters.yml#/ID'
@@ -37,7 +37,7 @@ delete:
3737
operationId: deleteABTest
3838
x-acl:
3939
- editSettings
40-
summary: Delete an A/B test.
40+
summary: Delete an A/B test
4141
description: Deletes an A/B test by its ID.
4242
parameters:
4343
- $ref: '../common/parameters.yml#/ID'

specs/abtesting/paths/abtests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ post:
44
operationId: addABTests
55
x-acl:
66
- editSettings
7-
summary: Create an A/B test.
7+
summary: Create an A/B test
88
description: Creates a new A/B test.
99
requestBody:
1010
required: true
@@ -59,7 +59,7 @@ get:
5959
operationId: listABTests
6060
x-acl:
6161
- analytics
62-
summary: List all A/B tests.
62+
summary: List all A/B tests
6363
description: Lists all A/B tests you configured for this application.
6464
parameters:
6565
- $ref: '../../common/parameters.yml#/Offset'

specs/abtesting/paths/stopABTest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ post:
44
operationId: stopABTest
55
x-acl:
66
- editSettings
7-
summary: Stop an A/B test.
7+
summary: Stop an A/B test
88
description: |
99
Stops an A/B test by its ID.
1010

specs/analytics/paths/click/getAddToCartRate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get:
44
operationId: getAddToCartRate
55
x-acl:
66
- analytics
7-
summary: Retrieve add-to-cart rate.
7+
summary: Retrieve add-to-cart rate
88
description: |
99
Retrieves the add-to-cart rate for all of your searches with at least one add-to-cart event, including a daily breakdown.
1010

specs/analytics/paths/click/getAverageClickPosition.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get:
44
operationId: getAverageClickPosition
55
x-acl:
66
- analytics
7-
summary: Retrieve average click position.
7+
summary: Retrieve average click position
88
description: |
99
Retrieves the average click position of your search results, including a daily breakdown.
1010

specs/analytics/paths/click/getClickPositions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get:
44
operationId: getClickPositions
55
x-acl:
66
- analytics
7-
summary: Retrieve click positions.
7+
summary: Retrieve click positions
88
description: |
99
Retrieves the positions in the search results and their associated number of clicks.
1010

specs/analytics/paths/click/getClickThroughRate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get:
44
operationId: getClickThroughRate
55
x-acl:
66
- analytics
7-
summary: Retrieve click-through rate.
7+
summary: Retrieve click-through rate
88
description: |
99
Retrieves the click-through rate for all of your searches with at least one click event, including a daily breakdown
1010

specs/analytics/paths/click/getConversionRate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get:
44
operationId: getConversionRate
55
x-acl:
66
- analytics
7-
summary: Retrieve conversion rate.
7+
summary: Retrieve conversion rate
88
description: |
99
Retrieves the conversion rate for all of your searches with at least one conversion event, including a daily breakdown.
1010

specs/analytics/paths/click/getPurchaseRate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get:
44
operationId: getPurchaseRate
55
x-acl:
66
- analytics
7-
summary: Retrieve purchase rate.
7+
summary: Retrieve purchase rate
88
description: |
99
Retrieves the purchase rate for all of your searches with at least one purchase event, including a daily breakdown.
1010

specs/analytics/paths/revenue/getRevenue.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get:
44
operationId: getRevenue
55
x-acl:
66
- analytics
7-
summary: Retrieve revenue data.
7+
summary: Retrieve revenue data
88
description: |
99
Retrieves revenue-related metrics, such as the total revenue or the average order value.
1010

specs/analytics/paths/search/getNoClickRate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get:
44
operationId: getNoClickRate
55
x-acl:
66
- analytics
7-
summary: Retrieve no click rate.
7+
summary: Retrieve no click rate
88
description: |
99
Retrieves the fraction of searches that didn't lead to any click within a time range, including a daily breakdown.
1010

specs/analytics/paths/search/getNoResultsRate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get:
44
operationId: getNoResultsRate
55
x-acl:
66
- analytics
7-
summary: Retrieve no results rate.
7+
summary: Retrieve no results rate
88
description: |
99
Retrieves the fraction of searches that didn't return any results within a time range, including a daily breakdown.
1010

specs/analytics/paths/search/getSearchesCount.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get:
44
operationId: getSearchesCount
55
x-acl:
66
- analytics
7-
summary: Retrieve number of searches.
7+
summary: Retrieve number of searches
88
description: |
99
Retrieves the number of searches within a time range, including a daily breakdown.
1010

specs/analytics/paths/search/getSearchesNoClicks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get:
44
operationId: getSearchesNoClicks
55
x-acl:
66
- analytics
7-
summary: Retrieve top searches without clicks.
7+
summary: Retrieve top searches without clicks
88
description: Retrieves the most popular searches that didn't lead to any clicks, from the 1,000 most frequent searches.
99
parameters:
1010
- $ref: '../../../common/parameters.yml#/Index'

specs/analytics/paths/search/getSearchesNoResults.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get:
44
operationId: getSearchesNoResults
55
x-acl:
66
- analytics
7-
summary: Retrieve top searches without results.
7+
summary: Retrieve top searches without results
88
description: Retrieves the most popular searches that didn't return any results.
99
parameters:
1010
- $ref: '../../../common/parameters.yml#/Index'

specs/analytics/paths/search/getTopCountries.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get:
44
operationId: getTopCountries
55
x-acl:
66
- analytics
7-
summary: Retrieve top countries.
7+
summary: Retrieve top countries
88
description: Retrieves the countries with the most searches to your index.
99
parameters:
1010
- $ref: '../../../common/parameters.yml#/Index'

specs/analytics/paths/search/getTopFilterAttributes.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get:
44
operationId: getTopFilterAttributes
55
x-acl:
66
- analytics
7-
summary: Retrieve top filters.
7+
summary: Retrieve top filters
88
description: |
99
Retrieves the most frequently used filter attributes.
1010

specs/analytics/paths/search/getTopFilterForAttribute.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get:
44
operationId: getTopFilterForAttribute
55
x-acl:
66
- analytics
7-
summary: Retrieve top filter values.
7+
summary: Retrieve top filter values
88
description: |
99
Retrieves the most frequent filter (facet) values for a filter attribute.
1010

specs/analytics/paths/search/getTopFiltersNoResults.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get:
44
operationId: getTopFiltersNoResults
55
x-acl:
66
- analytics
7-
summary: Retrieve top filters for a search without results.
7+
summary: Retrieve top filters for a search without results
88
description: |
99
Retrieves the most frequently used filters for a search that didn't return any results.
1010

specs/analytics/paths/search/getTopHits.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get:
44
operationId: getTopHits
55
x-acl:
66
- analytics
7-
summary: Retrieve top search results.
7+
summary: Retrieve top search results
88
description: Retrieves the object IDs of the most frequent search results.
99
parameters:
1010
- $ref: '../../../common/parameters.yml#/Index'

specs/analytics/paths/search/getTopSearches.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get:
44
operationId: getTopSearches
55
x-acl:
66
- analytics
7-
summary: Retrieve top searches.
7+
summary: Retrieve top searches
88
description: Returns the most popular search terms.
99
parameters:
1010
- $ref: '../../../common/parameters.yml#/Index'

specs/analytics/paths/search/getUsersCount.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get:
44
operationId: getUsersCount
55
x-acl:
66
- analytics
7-
summary: Retrieve number of users.
7+
summary: Retrieve number of users
88
description: |
99
Retrieves the number of unique users within a time range, including a daily breakdown.
1010

specs/analytics/paths/status/getStatus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ get:
44
operationId: getStatus
55
x-acl:
66
- analytics
7-
summary: Retrieve update status.
7+
summary: Retrieve update status
88
description: |
99
Retrieves the time when the Analytics data for the specified index was last updated.
1010

specs/common/schemas/CustomRequest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
customRequest:
2-
summary: Send requests to the Algolia REST API.
2+
summary: Send requests to the Algolia REST API
33
description: This method allow you to send requests to the Algolia REST API.
44
parameters:
55
- $ref: '#/PathInPath'

0 commit comments

Comments
 (0)