diff --git a/index.js b/index.js index 74be8dac..fe3e7d73 100644 --- a/index.js +++ b/index.js @@ -176,6 +176,9 @@ module.exports = { }, ], pathGroupsExcludedImportTypes: ['react', 'react-dom', 'prop-types'], + alphabetize: { + order: 'asc', + }, }, ], diff --git a/test/order-fail.jsx b/test/order-fail.jsx new file mode 100644 index 00000000..132d598b --- /dev/null +++ b/test/order-fail.jsx @@ -0,0 +1,14 @@ +/* eslint-disable no-unused-vars,import/no-unresolved,import/extensions */ +// import/order +import ReactDom from 'react-dom'; +import PropTypes from 'prop-types'; +import { Component, Fragment } from 'react'; + +import { fontSizeSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6'; +import ArrowUpIcon from '@skyscanner/backpack-web/bpk-component-icon/sm/long-arrow-up'; +import BpkButton from '@skyscanner/backpack-web/bpk-component-button'; +import BpkButtonLink from '@skyscanner/backpack-web/bpk-component-link'; + +import Component1 from '../Component1'; +import Component2 from '../../Component2'; +/* eslint-enable no-unused-vars,import/no-unresolved,import/extensions */ \ No newline at end of file diff --git a/test/package.json b/test/package.json index 04bf056a..02c31ec7 100644 --- a/test/package.json +++ b/test/package.json @@ -15,7 +15,8 @@ "test:fail-bpk": "echo 'Expecting failure' && eslint bpk-token-fail.jsx; if [ $? -eq 1 ]; then exit 0; fi", "test:fail-prettier": "echo 'Expecting failure' && eslint prettier-fail.jsx; if [ $? -eq 1 ]; then exit 0; fi", "test:fail-react": "echo 'Expecting failure' && eslint react-fail.tsx; if [ $? -eq 1 ]; then exit 0; fi", - "test": "npm run test:pass && npm run test:fail-jsdoc && npm run test:fail-bpk && npm run test:fail-prettier && npm run test:fail-react" + "test:fail-import-order": "echo 'Expecting failure' && eslint order-fail.jsx; if [ $? -eq 1 ]; then exit 0; fi", + "test": "npm run test:pass && npm run test:fail-jsdoc && npm run test:fail-bpk && npm run test:fail-prettier && npm run test:fail-react && npm run test:fail-import-order" }, "dependencies": { "prop-types": "^15.5.10", diff --git a/test/pass.jsx b/test/pass.jsx index 4f48e64d..ccf8856c 100644 --- a/test/pass.jsx +++ b/test/pass.jsx @@ -8,10 +8,10 @@ import ReactDom from 'react-dom'; import ExternalLibrary from 'external-library'; -import { fontSizeSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6'; -import BpkButton from 'bpk-component-button'; -import ArrowUpIcon from 'bpk-component-icon/sm/long-arrow-up'; +import BpkButton from '@skyscanner/backpack-web/bpk-component-button'; +import ArrowUpIcon from '@skyscanner/backpack-web/bpk-component-icon/sm/long-arrow-up'; import BpkButtonLink from '@skyscanner/backpack-web/bpk-component-link'; +import { fontSizeSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6'; import SomeCommonFunctionality from 'common/some-functionality';