Skip to content

Commit 8a28aba

Browse files
committed
[Lists][Exceptions] - Adding basic linting, i18n and storybook support (#94772)
### Summary In preparation for moving all the exceptions UI components into the lists plugin adds some linting, adds the lists plugin to the i18n config and adds storybook support. Tried to add a bit stricter linting than exists in the security solution right now, rules that we've talked about wanting to enable.
1 parent 60c8c02 commit 8a28aba

File tree

5 files changed

+67
-1
lines changed

5 files changed

+67
-1
lines changed

.eslintrc.js

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,62 @@ module.exports = {
950950
},
951951
},
952952
{
953-
// typescript and javascript for front and back end
953+
// typescript for /public and /common
954+
files: ['x-pack/plugins/lists/public/*.{ts,tsx}', 'x-pack/plugins/lists/common/*.{ts,tsx}'],
955+
rules: {
956+
'@typescript-eslint/no-for-in-array': 'error',
957+
},
958+
},
959+
{
960+
// typescript for /public and /common
961+
files: ['x-pack/plugins/lists/public/*.{ts,tsx}', 'x-pack/plugins/lists/common/*.{ts,tsx}'],
962+
plugins: ['react'],
963+
env: {
964+
jest: true,
965+
},
966+
rules: {
967+
'react/boolean-prop-naming': 'error',
968+
'react/button-has-type': 'error',
969+
'react/display-name': 'error',
970+
'react/forbid-dom-props': 'error',
971+
'react/no-access-state-in-setstate': 'error',
972+
'react/no-children-prop': 'error',
973+
'react/no-danger-with-children': 'error',
974+
'react/no-deprecated': 'error',
975+
'react/no-did-mount-set-state': 'error',
976+
'react/no-did-update-set-state': 'error',
977+
'react/no-direct-mutation-state': 'error',
978+
'react/no-find-dom-node': 'error',
979+
'react/no-redundant-should-component-update': 'error',
980+
'react/no-render-return-value': 'error',
981+
'react/no-typos': 'error',
982+
'react/no-string-refs': 'error',
983+
'react/no-this-in-sfc': 'error',
984+
'react/no-unescaped-entities': 'error',
985+
'react/no-unsafe': 'error',
986+
'react/no-unused-prop-types': 'error',
987+
'react/no-unused-state': 'error',
988+
'react/sort-comp': 'error',
989+
'react/void-dom-elements-no-children': 'error',
990+
'react/jsx-no-comment-textnodes': 'error',
991+
'react/jsx-no-literals': 'error',
992+
'react/jsx-no-target-blank': 'error',
993+
'react/jsx-fragments': 'error',
994+
'react/jsx-sort-default-props': 'error',
995+
},
996+
},
997+
{
998+
files: ['x-pack/plugins/lists/public/**/!(*.test).{js,mjs,ts,tsx}'],
999+
plugins: ['react-perf'],
1000+
rules: {
1001+
'react-perf/jsx-no-new-object-as-prop': 'error',
1002+
'react-perf/jsx-no-new-array-as-prop': 'error',
1003+
'react-perf/jsx-no-new-function-as-prop': 'error',
1004+
'react/jsx-no-bind': 'error',
1005+
},
1006+
},
1007+
{
1008+
// typescript and javascript for front and back
9541009
files: ['x-pack/plugins/lists/**/*.{js,mjs,ts,tsx}'],
9551010
plugins: ['eslint-plugin-node'],
9561011
env: {

src/dev/storybook/aliases.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ export const storybookAliases = {
2222
ui_actions_enhanced: 'x-pack/plugins/ui_actions_enhanced/.storybook',
2323
observability: 'x-pack/plugins/observability/.storybook',
2424
presentation: 'src/plugins/presentation_util/storybook',
25+
lists: 'x-pack/plugins/lists/.storybook',
2526
};

test/scripts/jenkins_storybook.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ yarn storybook --site security_solution
2121
yarn storybook --site ui_actions_enhanced
2222
yarn storybook --site observability
2323
yarn storybook --site presentation
24+
yarn storybook --site lists

x-pack/.i18nrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"xpack.lens": "plugins/lens",
3434
"xpack.licenseMgmt": "plugins/license_management",
3535
"xpack.licensing": "plugins/licensing",
36+
"xpack.lists": "plugins/lists",
3637
"xpack.logstash": ["plugins/logstash"],
3738
"xpack.main": ["plugins/xpack_legacy"],
3839
"xpack.maps": ["plugins/maps"],
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
module.exports = require('@kbn/storybook').defaultConfig;

0 commit comments

Comments
 (0)