regexFind: /(export|import)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/
regexReplace: $2(Remove invalid modifier from class method. Export and import modifiers cannot be used on class methods - they are only for module-level declarations.
class MyClass {
- export method() {
+ method() {
return 'test'
}
}Explanation: Remove export modifier from class method declaration
class DataClass {
- import process() {
+ process() {
return 'data'
}
}Explanation: Remove import modifier from class method declaration
npx tsc ./docs/1031/index.ts --noEmit --prettydocs/1031/index.ts:2:3 - error TS1031: 'export' modifier cannot appear on class elements of this kind.
2 export method() {
~~~~~~OR (without --pretty flag):
docs/1031/index.ts(2,3): error TS1031: 'export' modifier cannot appear on class elements of this kind.