esify
now has its own repository (https://github.com/Shopify/esify)
- Updated ESLint and added the following rules:
no-return-await
,no-useless-return
, andfunc-name-matching
. - esify now applies ESlint fixes to all transformed code
- Added a
split-assignment-sequences
transform toshopify-codemod
. This simplifies destructuring syntax generated bydecaf
. - Added a warning about
for..in
loops being translated tofor...Object.entries
-style loops. - Added a warning about
for..in
loops accruing null-safe fallbacks.
- Fixed
split-if-assignments
codemod's handling ofelse if
assignments. remove-unused-expressions
codemod now outputs the line of code being removed, plus some extra contextremove-unused-expressions
codemod now whitelists some properties (offsetHeight
,offsetWidth
.)
- The
react
ESLint config no longer warns about missingthis
in React lifecycle methods.
- Removed the
flow/type-id-match
rule. - Temporarily disabled the
react/forbid-component-props
rule as it throws errors in some cases.
- The Node Babel preset now includes the destructuring transform, which is required for object rest spread.
- Added separate React (
shopify/react
), Flow (shopify/flow
), and Web (shopify/web
) Babel presets tobabel-preset-shopify
. - Updated all ESLint dependencies, which add the following rules:
ava/no-async-fn-without-await
,ava/no-duplicate-modifiers
,class-methods-use-this
,no-restricted-properties
,prefer-numeric-literals
,sort-imports
,symbol-description
,flowtype/boolean-style
,flowtype/delimiter-dangle
,flowtype/generic-spacing
,flowtype/generic-spacing
,flowtype/no-dupe-keys
,flowtype/no-weak-types
,flowtype/semi
,flowtype/sort-keys
,flowtype/space-before-generic-bracket
,flowtype/union-intersection-spacing
,import/no-dynamic-require
,import/no-internal-modules
,import/no-absolute-path
,import/no-webpack-loader-syntax
,import/unambiguous
,import/first
,import/max-dependencies
,import/no-unassigned-import
,jsx-a11y/click-events-have-key-events
,jsx-a11y/no-static-element-interactions
,mocha/no-hooks-for-single-case
,mocha/no-identical-title
,mocha/no-return-and-callback
,mocha/no-top-level-hooks
,mocha/no-nested-tests
,mocha/max-top-level-suites
,node/exports-style
,node/no-unpublished-bin
,react/no-children-prop
,react/no-unescaped-entities
,react/no-unused-prop-types
,react/style-prop-object
,lines-around-directive
, andline-comment-position
.
- The default Babel preset no longer includes React. If you are writing a web project that uses React, you should use
shopify/web
andshopify/react
together instead of just usingshopify
. - The Node preset in
babel-preset-shopify
now accepts an options object specifying whether ES2015 modules should be converted to CommonJS (modules
) and the target version of Node to transpile for (version
, defaults toprocess.version
). - Turned off the
no-sync
andno-process-exit
rules for the Node ESLint config.
flowtype/type-id-match
now properly acceptsProps
,State
, andContext
as valid type names.
- Set
babel/func-params-comma-dangle
toalways-multiline
to be consistent withcomma-dangle
.
- Updated dependencies which added the following rules:
no-tabs
,sort-keys
,no-template-curly-in-string
,ava/no-nested-tests
,ava/no-todo-implementation
,ava/prefer-async-await
,flowtype/define-flow-type
,flowtype/use-flow-type
,flowtype/valid-syntax
,jsx-a11y/anchor-has-content
,mocha/no-hooks
,mocha/no-arrows
,mocha/no-sibling-hooks
,mocha/no-synchronous-tests
,react/forbid-component-props
, andreact/no-danger-with-children
,react/no-find-dom-node
. - Added stronger recommendations to use Flow in place of React’s
PropTypes
. - Added a recomendation to only import the parts of React you need (rather than accessing them as properties on
React
). - Added recommendations for how to deal with components that have one or more dependant subcomponents.
- Changed the
indent
linting rule to require one level of indenting (two spaces) forcase
statements and for member expressions on separate lines. - Changed the
react/jsx-no-bind
ESLint rule to prevent binding functions in render methods. - The following rules were renamed or removed based on deprecations in the updates noted above:
no-spaced-func
(tofunc-call-spacing
),no-negated-in-lhs
(tono-unsafe-negation
),no-native-reassign
(tono-global-assign
),react/no-comment-textnodes
(toreact/jsx-no-comment-textnodes
),react/require-extension
, andreact/wrap-multilines
(toreact/jsx-wrap-multilines
). - Updated
flowtype/type-id-match
to allow for any type name ending inType
,Props
,State
, orContext
. - Turned off
react/no-danger
in favor of enablingreact/no-danger-with-children
.
- Updated ESLint to 3.1, which adds the following rules:
max-lines
,no-mixed-operators
,object-curly-newline
,unicode-bom
,no-prototype-builtins
,no-useless-rename
,multiline-ternary
, andrest-spread-spacing
. - Added forgotten ESLint rules:
no-negated-condition
,no-restricted-syntax
, andrequire-jsdoc
. - Updated other linting plugins, which added the following rules:
babel/func-params-comma-dangle
,import/no-restricted-paths
,flowtype/require-valid-file-annotation
,jsx-a11y/heading-has-content
,jsx-a11y/html-has-lang
,jsx-a11y/lang
,jsx-a11y/no-marquee
,jsx-a11y/scope
,mocha/valid-suite-description
,mocha/valid-test-description
,node/no-deprecated-api
,node/process-exit-as-throw
,promise/no-native
,react/no-comment-textnodes
,react/require-optimization
,react/jsx-handler-names
,react/jsx-filename-extension
, andreact/no-render-return-value
.
- Removed the requirement to omit braces for arrow functions whose body is a single return statement. The styleguide now recommends omitting for simple, single-line return statements, and braces are permitted where they improve legibility.
- Removed lint checks for sorting of properties in React components (the guidance on ordering remains, but the linting rule was too coarse to be useful in all situations).
- Turned off the lint rule requiring a default export in modules exporting only a single binding to allow for modules that make sense as utilities but export only a single named binding.
- Updated all custom ESLint rules in
eslint-plugin-shopify
to use the new ESLint rule format. eslint-plugin-shopify/node
now has errors for missing and unpublishedeslint-plugin-shopify/react
now warns when your component could be a functional component (that is, when it has no state and no lifecycle hooks).
shopify/require-flow
linting rule now understands flow directives in line comments (in addition to block comments).
- Added a test for
eslint-plugin-shopify
to fail if it has unconfigured rules from ESLint or any depended-upon plugins.
- Added a node.js-specific Babel preset to
babel-preset-shopify
, usable by extending theshopify/node
babel preset. - Added a
prefer-twine
rule toeslint-plugin-shopify
to warn on the use of non-Twine
local identifiers for twine imports. - Added additional warnings about esify limitations.
global-reference-to-import
no longer reports export conflicts incoffee
/js
files with the same name (regression introduced in 12.3.0).global-reference-to-import
discovers exports in files with a.js.erb
suffixavoid-returning-unused-results
now handles additional edge cases.
eslint-plugin-shopify/mocha
now disables some rules that did not work well with Chai’sexpect
syntax.eslint-plugin-shopify
now ignores imports of style files to play nicely with CSS modules.
- Added an
existential-assignment-to-if-statement
transform that removes dead code fromdecaf
's?=
output. - Added an
arguments-to-args-spread
transform that adds an...args
spread to functions that referencearguments
. - Added a
split-if-assignments
transform that moves assignments out ofif
conditions. arrow-body-style
guidance for a single multiline return.- Default options for the
global-identifier-to-import
transform to importtwine
when referencingBindings
orTwine
in the original code.
ignores-if-else-with-following-statements
now handles argumentlessreturn
statements.README
now includes details of doc file generation/update for transforms managed bycreate-transform
/rename-transform
scripts.global-reference-to-import
now handles named exports.
- Added a looser peer dependency on ESLint for
eslint-plugin-shopify
.
- Added guidance for installing a search binary to
global-reference-to-import
's error message. - Added an
iife-to-ternary-expression
transform that converts some IIFE assignments to ternary assignments.
global-assignment-to-default-export
now allows prototype assignments to the default export object.
- Fixed the naming of the
avoid-returning-unused-results
transform.
- Transform generator script now generates documentation files. (#180)
- Added a
split-return-assignments
transform to move any returned assignment expressions to be an assignment expression followed by a return statement of just the final value. (#134) - Added a
avoid-returning-unused-results
transform to remove return statement arguments from callbacks that are known to be ignored by the callee. (#173) - Added a
avoid-returning-useless-expressions
transform to remove return statement arguments that are known to returnundefined
. (#173) - Added a
remove-unused-expressions
transform to remove any expression without side effects. (#173)
esify
no longer changes the case of the transformed file. (#178)
- Fixes the method for running ESLint so it does not spawn a new process for each file. (#177)
- Moved documentation of all codemods in
shopify-codemod
to be separate markdown files. (#168)
esify
now will find and run a locally-installed version of ESLint with the--fix
flag in order to correct simple formatting issues. (#152)
- Added a
add-missing-parseint-radix
transform to add missing radix parameters toparseInt
calls. (#145) - Added a
implicit-coercion-to-explicit
transform to convert!!foo
and+foo
to their more explicit counterparts. (#149) - Added a
empty-func-to-lodash-noop
transform to correct empty function linting errors by replacing empty functions with_.noop
. (#148) - Added a
remove-empty-statements
transform to get rid of pesky excess semicolons. (#151)
- Fixed edge cases that were failing for the
default-export-object-to-named-exports
transform. (#151)
- Fixed the name for transform tests generated by
bin/create-transform
. (#151)
- Added a simple set of warnings for
esify
to signal potentially problematic transformations, and added documentation as to what kinds of CoffeeScript patterns might not translate correctly. (#146)
- Fixed an incorrect path in
esify
that caused the transformations to fail.
- Updated
spaced-comment
ESLint rule to allow for=
immediately after comments (used in Sprockets directives). (#144)
- Added a
global-identifier-to-import
transform to import any global from a user-provided list used in a module. (#90) - Added a
remove-trailing-else-undefined-return
transform to remove useless trailing alternate returns. (#91) - Added a
convert-default-export-objects-to-named-exports
. (#129) - Updated ESLint and all plugins for
eslint-plugin-shopify
, which added the following rules (in addition to many fixes):ava/assertion-arguments
,babel/flow-object-type
,import/no-extraneous-dependencies
,import/no-mutable-exports
,import/no-nodejs-modules
,import/extensions
,import/order
,import/newline-after-import
,import/prefer-default-export
,lodash/consistent-compose
,no-unsafe-finally
, andreact/jsx-no-target-blank
. (#93) esify
now accepts multiple files or glob patterns for conversion. (#89)- Added
rename-identifier
andrename-property
transforms to make it easy to transition between aliased names. (#139) - Added a
computed-literal-keys-to-dot-notation
transform to correct any linting errors related todot-notation
. (#141)
- Reorganized transforms to catch more issues. (#90)
remove-useless-return-from-test
transform now also removes trailing IIFEs. (#90)- Changed
object-shorthand
linting rule towarn
(wasoff
), except in cases where the keys of objects require quotes. (#93) - Changed
object-shorthand
linting rule towarn
(wasoff
) when single-line object literals have spaces inside the curly braces. (#93) global-reference-to-import
transform now avoids importing the file itself when using the global name of the exported object. It also uses a global cache for lookups, which increases the speed of transformations for large groups of files. (#131)
function-to-arrow
now correctly removes blocks from single-return arrow function expressions. (#136)mocha-context-to-closure
now avoids transforming context assignments that are computed rather than a literal. (#128)- Fixed some jQuery reference detection edge cases for the
jquery-dollar-sign-reference
linting rule. (#142) - Fixed some additional existential/ soak operator edge cases for the
coffeescript-soak-to-condition
transform. (#135)
- Removed
generator-eslint-shopify
. (#93)
- Updated all development dependencies. (#93)
- Added scripts for generating new transforms and renaming existing transforms. (#130)
- Improved the process and quality of this document (#140)
- Added
coffeescript-soak-to-condition
transform to better handle CoffeeScript’s soak and existential operator. - Added
remove-addeventlistener-returns
andremove-empty-returns
transforms to remove unecessary transforms left from CoffeeScript conversions.
- Improved the order of transforms so that the most generic/ stylistic transforms are run last.
- Moved more generic transforms to the end of
esify
’s transform list to ensure that they pick up any changes introduced in earlier transforms. - Improved CoffeeScript range transform.
- Misconfigured eslint rules in
esify
.
- Added flexible
esify
configuration (esify.config.js
.) - Added
constructor-literal-assignment-to-class-property
transform that converts static/instance constructor assignments to class properties. - Added
strip-template-literal-parenthesis
transform that removes unnecessary parenthesis from template strings. - Added more
jsx-a11y
rules.
- Updated
jsx-a11y
rules. - Style guide no longer recommends
shopify/prefer-class-properties
. - Removed
prefer-class-properties
warning removed fromeslint-plugin-shopify
.
- Fixed an issue where
jquery-dollar-sign-reference
would incorrectly reportnull
values.
- Fixed a configuration error in
eslint-plugin-react
.
- Added a
no-fully-static-classes
rule to prevent classes with only static members. - Added a code of conduct.
- Fixed an error in
sinon-prefer-meaningful-assertions
when there was an emptyexpect
call expression. - Fixed an error in
prefer-early-return
related to conditional expressions that consist only of a single expression.
- Fixed a case where the
jquery-dollar-sign-reference
rule would fail when a name in a jQuery chain matched a built-in object property name.
- Added additional ESLint rules to the ESNext shared configuration from the following plugins:
eslint-plugin-sort-class-members
,eslint-plugin-import
, andeslint-plugin-promise
, which provide additional linting rules around classes,import
/export
statements, and promises. - Added additional plugins and custom configurations for lodash, mocha/ sinon/ chai, AVA, flow, and jQuery. These custom configurations are exported by
eslint-plugin-shopify
, and are meant to be used in addition to thees5
,esnext
, orreact
core configurations. See theeslint-plugin-shopify
readme for details. - Added additional accessibility-related rules to the
react
shared ESLint configuration. - Added the following custom ESLint rules to the relevant configurations:
class-property-semi
,jquery-dollar-sign-reference
,no-useless-computed-properties
,prefer-class-properties
,prefer-early-return
,restrict-full-import
,sinon-no-restricted-features
, andsinon-prefer-meaningful-assertions
. - Added
esify
, a tool for converting Shopify’s CoffeeScript to JavaScript, as a package in this repo.
- Removed node-related rules from the
es5
shared configuration. Node rules (including some new rules to help with pragmas andrequire
statements) are now available through a separatenode
shared configuration, which is meant to be used in conjunction with one of the core configurations. - Updated versions of
eslint
andeslint-plugin-shopify
.
- Updated all development dependencies to the latest versions.
- Added a
coffeescript-range-output-to-helper
transform toshopify-codemod
to provide a better conversion for CoffeeScript range syntax.
- Renamed
mocha-context-to-global-references
transform tomocha-context-to-global-reference
.
- Added a
mocha-context-to-global-reference
transform toshopify-codemod
to transform uses of context-injected properties (from, for instance, a sinon sandbox) to use a specified global instead. - Added Enzyme as a recommended utility for testing React codebases.
- Added a
conditional-assign-to-if-statement
transform toshopify-codemod
to convert the common CoffeeScript translation idiom offoo || (foo = bar)
into a more appropriate JavaScript idiom.
- Updated the
mocha-context-to-closure
rule to also transform uses ofthis
inside contextually-declared functions.
- Updated version of
npm
used in CI.
- Added
eslint-plugin-babel
as a dependency foreslint-plugin-shopify
to fix some linting issues with ESNext features. Most notably, this fixes the wayobject-curly-spacing
would fail on someimport
statements, and howarrow-parens
would fail forasync
functions. The following rules are now updated to use theeslint-plugin-babel
equivalents:array-bracket-spacing
,arrow-parens
,generator-star-spacing
,new-cap
,no-await-in-loop
,object-curly-spacing
, andobject-shorthand
. - Added new ESLint rules:
no-useless-escape
,no-duplicate-imports
,no-restricted-globals
, andmax-statements-per-line
. - Added a new
eslint-plugin-react
rule:prefer-stateless-function
(off by default, because of issues with React’s testing utilities).
- Used the new string severity levels introduced in ESLint 2.5.0.
- Bumped the node version for the project.
- Updated to the most recent versions of dependencies.
- Prevents the two transforms added in
10.7.0
from clobbering existing directives.
- Added
global-assignment-to-default-export
transform, which automatically exports a single global set within a given file. - Added
global-reference-to-import
transform, which searches through the file system to find the source of a global reference, and transforms that reference into the appropriate identifier andimport
statement.
- Prevented
function-to-arrow
transform inshopify-codemod
from incorrectly transforming methods using the shorthand syntax.
- Set up the babel config for
shopify-codemod
.
- Add
remove-useless-return-from-test
rule toshopify-codemod
repo, which removes unnecessaryreturn
s at the end of test files that the CoffeeScript to JavaScript conversion leaves behind.
- Extracted
chai-jscodeshift
into its own package.
- Moved all shared development dependencies to be in the root
package.json
in order to speed up bootsrapping. Only project-specific development dependencies should be in the individual projects.
- Add
function-to-arrow
transform.
- Add
constant-function-expression-to-statement
transform. - Add
ternary-statement-to-if-statement
transform.
- Added the initial
shopify-codemod
package.
- Set the default config of
shopify/require-flow
to disabled.
- Added
babel-plugin-transform-inline-environment-variables
tobabel-preset-shopify
.
- Added the
babel-preset-shopify
package to contain our recommended set of Babel transforms.
- Removed
rimraf
andcopyfiles
as dependencies and used the native UNIX commands instead.
- Fixed
react/display-name
’signoreTranspilerName
, again (the new option negated the meaning of the passed value).
- Fixed
react/display-name
’signoreTranspilerName
option (the old option name was removed in the most recent version of the plugin).
- Added new React ESLint rules:
jsx-space-before-closing
andsort-prop-types
.
- Updated Babel ESLint plugin.
- Updated the React
sort-comp
rule to require static members of a React component appearing first. - Documented preference for storing configuration in
package.json
, or in.js
files whenpackage.json
is not possible.
- Removed deprecated React ESLint rule:
jsx-sort-prop-types
.
- Updated ESLint and Babel configs to match our recommended locations (
package.json
and.eslintrc.js
).
- Updated ESLint peer dependency to 2.1.0.
- Consolidated
eslint-config-shopify
intoeslint-plugin-shopify
as part of the new plugin configs offered by ESLint 2.0.0. This means that only a single package needs to be installed:eslint-plugin-shopify
. The"extends"
key in your.eslintrc
will need to change to reflect this:"shopify"
becomes"plugin:shopify/esnext"
,"shopify/react"
becomes"plugin:shopify/react"
, and"shopify/es5"
becomes"plugin:shopify/es5"
. - Moved
babel-eslint
andeslint-plugin-react
to be dependencies of the new plugin, which means that consuming projects no longer need to install those dependencies themselves. - Made
generator-eslint-shopify
understand and install the correct packages.
- Added new ESLint rules:
array-callback-return
,id-blacklist
,keyword-spacing
,newline-per-chained-call
,no-confusing-arrow
,no-empty-function
,no-extra-label
,no-implicit-globals
,no-new-symbol
,no-restricted-imports
,no-self-assign
,no-unmodified-loop-condition
,no-unused-labels
,no-useless-constructor
,no-whitespace-before-property
,one-var-declaration-per-line
,prefer-rest-params
,sort-imports
,template-curly-spacing
, andyield-star-spacing
.
- Removed deprecated ESLint rules:
no-arrow-condition
,no-empty-label
,space-after-keywords
,space-before-keywords
, andspace-return-throw-case
.
- Added back
merge
foreslint-config-shopify
to prevent issues with older versions of node.
- Initial commit of the new repo structure.