Skip to content

Commit 90b213b

Browse files
authored
chore: Restrict further import order (#2795)
1 parent 4be2a04 commit 90b213b

File tree

42 files changed

+184
-145
lines changed

Some content is hidden

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

42 files changed

+184
-145
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"lwc-internal/no-invalid-todo": "error",
9595
"import/order": [
9696
"error",
97-
{ "groups": [["builtin", "external", "internal"]] }
97+
{ "groups": ["builtin", "external", "internal", "parent", "index", "sibling", "object", "type"] }
9898
]
9999
},
100100

packages/@lwc/babel-plugin-component/src/decorators/api/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
* SPDX-License-Identifier: MIT
55
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
66
*/
7-
const validate = require('./validate');
8-
const transform = require('./transform');
97
const {
108
LWC_PACKAGE_EXPORTS: { API_DECORATOR },
119
} = require('../../constants');
1210

11+
const validate = require('./validate');
12+
const transform = require('./transform');
13+
1314
module.exports = {
1415
name: API_DECORATOR,
1516
validate,

packages/@lwc/babel-plugin-component/src/decorators/api/transform.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
* SPDX-License-Identifier: MIT
55
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
66
*/
7-
const { isApiDecorator } = require('./shared');
87
const {
98
DECORATOR_TYPES,
109
LWC_COMPONENT_PROPERTIES: { PUBLIC_METHODS, PUBLIC_PROPS },
1110
} = require('../../constants');
1211

12+
const { isApiDecorator } = require('./shared');
13+
1314
const PUBLIC_PROP_BIT_MASK = {
1415
PROPERTY: 0,
1516
GETTER: 1,

packages/@lwc/babel-plugin-component/src/decorators/api/validate.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@
55
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
66
*/
77
const { DecoratorErrors } = require('@lwc/errors');
8-
const { isApiDecorator } = require('./shared');
8+
9+
const { generateError } = require('../../utils');
910
const {
1011
AMBIGUOUS_PROP_SET,
1112
DISALLOWED_PROP_SET,
1213
LWC_PACKAGE_EXPORTS: { TRACK_DECORATOR },
1314
DECORATOR_TYPES,
1415
} = require('../../constants');
1516

16-
const { generateError } = require('../../utils');
17+
const { isApiDecorator } = require('./shared');
1718

1819
function validateConflict(path, decorators) {
1920
const isPublicFieldTracked = decorators.some(

packages/@lwc/babel-plugin-component/src/decorators/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
const moduleImports = require('@babel/helper-module-imports');
88
const { DecoratorErrors } = require('@lwc/errors');
99

10-
const api = require('./api');
11-
const wire = require('./wire');
12-
const track = require('./track');
13-
1410
const { DECORATOR_TYPES, LWC_PACKAGE_ALIAS, REGISTER_DECORATORS_ID } = require('../constants');
1511
const {
1612
generateError,
@@ -19,6 +15,10 @@ const {
1915
isGetterClassMethod,
2016
} = require('../utils');
2117

18+
const api = require('./api');
19+
const wire = require('./wire');
20+
const track = require('./track');
21+
2222
const DECORATOR_TRANSFORMS = [api, wire, track];
2323
const AVAILABLE_DECORATORS = DECORATOR_TRANSFORMS.map((transform) => transform.name).join(', ');
2424

packages/@lwc/babel-plugin-component/src/decorators/wire/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
* SPDX-License-Identifier: MIT
55
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
66
*/
7-
const validate = require('./validate');
8-
const transform = require('./transform');
97
const {
108
LWC_PACKAGE_EXPORTS: { WIRE_DECORATOR },
119
} = require('../../constants');
1210

11+
const validate = require('./validate');
12+
const transform = require('./transform');
13+
1314
module.exports = {
1415
name: WIRE_DECORATOR,
1516
validate,

packages/@lwc/babel-plugin-component/src/decorators/wire/transform.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
* SPDX-License-Identifier: MIT
55
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
66
*/
7-
const { isWireDecorator } = require('./shared');
87
const { LWC_COMPONENT_PROPERTIES } = require('../../constants');
98

9+
const { isWireDecorator } = require('./shared');
10+
1011
const WIRE_PARAM_PREFIX = '$';
1112
const WIRE_CONFIG_ARG_NAME = '$cmp';
1213

packages/@lwc/babel-plugin-component/src/decorators/wire/validate.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
66
*/
77
const { DecoratorErrors } = require('@lwc/errors');
8-
const { isWireDecorator } = require('./shared');
98
const {
109
LWC_PACKAGE_EXPORTS: { WIRE_DECORATOR, TRACK_DECORATOR, API_DECORATOR },
1110
} = require('../../constants');
1211
const { generateError } = require('../../utils');
1312

13+
const { isWireDecorator } = require('./shared');
14+
1415
function validateWireParameters(path) {
1516
const [id, config] = path.get('expression.arguments');
1617

packages/@lwc/engine-core/src/framework/base-lightning-element.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ import {
2424
KEY__SYNTHETIC_MODE,
2525
setPrototypeOf,
2626
} from '@lwc/shared';
27+
28+
import { logError } from '../shared/logger';
29+
import { getComponentTag } from '../shared/format';
2730
import {
2831
getChildren,
2932
getChildNodes,
@@ -47,6 +50,7 @@ import {
4750
querySelector,
4851
querySelectorAll,
4952
} from '../renderer';
53+
5054
import { HTMLElementOriginalDescriptors } from './html-properties';
5155
import { getWrappedComponentsListener } from './component';
5256
import { vmBeingConstructed, isBeingConstructed, isInvokingRender } from './invoker';
@@ -60,8 +64,6 @@ import {
6064
} from './restrictions';
6165
import { unlockAttribute, lockAttribute } from './attributes';
6266
import { Template, isUpdatingTemplate, getVMBeingRendered } from './template';
63-
import { logError } from '../shared/logger';
64-
import { getComponentTag } from '../shared/format';
6567
import { HTMLElementConstructor } from './base-bridge-element';
6668
import { lockerLivePropertyKey } from './membrane';
6769

packages/@lwc/engine-core/src/framework/check-version-mismatch.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
66
*/
77
import { isNull, LWC_VERSION, LWC_VERSION_COMMENT_REGEX } from '@lwc/shared';
8+
9+
import { logError } from '../shared/logger';
10+
811
import { Template } from './template';
912
import { StylesheetFactory } from './stylesheet';
1013
import { LightningElementConstructor } from './base-lightning-element';
11-
import { logError } from '../shared/logger';
1214

1315
let warned = false;
1416

0 commit comments

Comments
 (0)